MercurialAlchemi has quit [Ping timeout: 246 seconds]
jonasen has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]
pyon has quit [Quit: Ihnen, Herr Lasker, habe ich nur drei Worte zu sagen: Nyan und Pasu~.]
pyon has joined #ocaml
Sorella has quit [Quit: Connection closed for inactivity]
larhat has quit [Quit: Leaving.]
uriznik has joined #ocaml
A1977494 has joined #ocaml
MercurialAlchemi has joined #ocaml
madroach has quit [Quit: leaving]
adi___ has quit [Ping timeout: 260 seconds]
adi___ has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
darkf has quit [Ping timeout: 250 seconds]
redpoppies has joined #ocaml
redpoppies has quit [Client Quit]
guardianJ has joined #ocaml
guardianJ has quit [Remote host closed the connection]
orbifx-m2 has joined #ocaml
orbifx-m has quit [Ping timeout: 240 seconds]
Simn has joined #ocaml
FreeBird_ has joined #ocaml
larhat has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 246 seconds]
FreeBird_ has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
dexterph has joined #ocaml
zaquest has joined #ocaml
ygrek_ has joined #ocaml
thizanne has quit [Ping timeout: 244 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
dexterph has quit [Read error: Connection reset by peer]
dexterph has joined #ocaml
<Leonidas>
def`: yes, this is btw exactly what I asked chenglou when they changed to /* */ comments whether they will support nested comments or fail like C does :)
<mrvn>
Leonidas: ocamls nested comments let you comment out any valid ocaml code without getting confused, like: # let x = (* "*)" *) 1;;
<mrvn>
val x : int = 1
<Leonidas>
mrvn: I know. That's very nice. I am kinda surprised that C gets this wrong (C++ style comments weren't added that long ago after all)
<flux>
well, C also has the preprocessor for disabling code
<flux>
leaving the rules for comments much more relaxed..
jwatzman|work has joined #ocaml
<mrvn>
they screwed up /* */ at first. Now they can't fix it without breaking existing code.
<mrvn>
nested comments are hard to parse so they initially wouldn't do it. Not enough ram, code space and cpu time.
freux has joined #ocaml
<freux>
hello everyone. are any nix users here? specifically, has anyone been able to install ocamlfind via opam on nix?
zRecursive has quit [Remote host closed the connection]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
silver has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
groovy2shoes has quit [Quit: Leaving]
sdothum has joined #ocaml
Kakadu has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
jwatzman|work has quit [Quit: jwatzman|work]
uriznik has left #ocaml [#ocaml]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
freux has quit [Ping timeout: 272 seconds]
connorjacobsen has joined #ocaml
connorjacobsen has quit [Ping timeout: 250 seconds]
octachron has joined #ocaml
jwatzman|work has joined #ocaml
Orion3k has quit [Ping timeout: 276 seconds]
Orion3k has joined #ocaml
rgrinberg has joined #ocaml
TheLemonMan has joined #ocaml
orbifx-m2 has quit [Ping timeout: 264 seconds]
steve_gh has joined #ocaml
ygrek_ has quit [Ping timeout: 250 seconds]
MercurialAlchemi has quit [Ping timeout: 260 seconds]
<steve_gh>
dumb question: A common OCaml pattern is to build a function out of a series of let ... in clauses with a final assignment that is returned.
<steve_gh>
But what if I have a sequence of changes to a mutable variable (such as an array) in a function. Is there a better alternative to something like
two_wheels has joined #ocaml
<steve_gh>
let _ = array.(0) <- 1.0 in let _ = array.(1) <- 1.0 in ...
<Drup>
well, there is ";"
<chelfi>
steve_gh: you can use a semicolon here, like array.(0) <- 1.0; array.(1) <- 1.0
MercurialAlchemi has joined #ocaml
tane has joined #ocaml
ygrek has joined #ocaml
<chelfi>
also I think that you should prefer let () = instead of let _ = because let () ensures that you are calling function of type unit (which almost always is a side effecting function) rather than accidentaly calling a pure function and not binding its result
<chelfi>
(of course this assumes that the type of your statement is unit, which is not always true even for side effecting functions)
<mrvn>
While I agree with let () I don't think this has anything to do with pure functions
<steve_gh>
thxs Drup. This is what I was looking for. For some reason I failed to find it in Real World OCaml.
<chelfi>
mrvn: lets forget about this part then
<mrvn>
Reason for "let () = ... over _": If the return type is unit it doesn't matter, if the return type is not unit then the first will tell you. You can't accidentally drop a return type.
<Drup>
chelfi: it's more a protection against partially applied functions.
kushal has joined #ocaml
<mrvn>
partially applied function being a major pain to find for dropped returns.
<mrvn>
They look right and you can read over them 20 times and not notice that a partial application does not return ()
FreeBird_ has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 276 seconds]
<chelfi>
definitely, but it also applies when the return type of your function call is not unit
sepp2k has joined #ocaml
<chelfi>
I mean, let f () = 5 in let () = f () will return an error while let _ = f () will not
FreeBird_ has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
ygrek has quit [Ping timeout: 272 seconds]
al-damiri has quit [Quit: Connection closed for inactivity]
kushal has quit [Ping timeout: 272 seconds]
kushal has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 276 seconds]
FreeBirdLjj has joined #ocaml
Orion3k has quit [Ping timeout: 244 seconds]
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
madroach has joined #ocaml
FreeBirdLjj has quit [Read error: Connection reset by peer]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
copy` has joined #ocaml
FreeBirdLjj has quit [Remote host closed the connection]
FreeBirdLjj has joined #ocaml
FreeBirdLjj has quit [Ping timeout: 240 seconds]
<pitastrudl>
so i got this substring problem here, and it's not like i dont know how nested for loops work or have a problem with the syntax...i just dont know where i did something wrong
<pitastrudl>
it's supposed to print a set of substrings of a string
<pitastrudl>
like it seems trivial but i feel like im missing something...even wrote it down on paper and getting nowhere. initially i'd want it to start printing at the next character everytime the second loop goes trough
<pitastrudl>
start at the next character*
<pitastrudl>
supposedly i only need two for loops but i cant imagine doing it with only two
<zozozo>
pitastrudl: I don't see 'j' being used anywhere...
<pitastrudl>
zozozo: i tried doing stuff with j too but i just dont see what could work
<zozozo>
pitastrudl: if you want to have an output similar to that you wrote for "banana", I'd suggest looping with j from String.length - 1 to i, and printing characters between i and j
MercurialAlchemi has quit [Ping timeout: 250 seconds]
tmtwd has joined #ocaml
pierpa has joined #ocaml
cmk_zzz has quit [Ping timeout: 252 seconds]
Denommus has joined #ocaml
wiredsister has joined #ocaml
cmk_zzz has joined #ocaml
circ-user-vkmXT_ has joined #ocaml
circ-user-vkmXT has quit [Ping timeout: 260 seconds]
connorjacobsen has joined #ocaml
sh0t has quit [Remote host closed the connection]
M-Illandan has quit [Read error: Connection reset by peer]
M-martinklepsch has quit [Read error: Connection reset by peer]
M-pesterhazy1 has quit [Read error: Connection reset by peer]
sh0t has joined #ocaml
connorjacobsen has quit [Ping timeout: 250 seconds]
aphprentice has quit [Ping timeout: 258 seconds]
aphprentice has joined #ocaml
MercurialAlchemi has joined #ocaml
A1977494 has quit [Ping timeout: 250 seconds]
dexterph has quit [Ping timeout: 244 seconds]
M-martinklepsch has joined #ocaml
A1977494 has joined #ocaml
<steve_gh>
Hi - I'm wondering why the compiler is complaining about this:
<steve_gh>
match l with [] -> failwith "Empty" | x -> (let hh::_ = x in let tt::_ = List.rev x in hh::[tt]);;
<companion_cube>
the [tt] is wrong (it's a list of lists)
<steve_gh>
It warns me that the patterns hh::_ and tt::_ are not exhaustively matched - but surely the empty list has already been caught in the match statement
<companion_cube>
also, no need to write `lt hh::_ = x`, you could write `| (hh::_) as x -> let tt::_ = List.rev x in hh::tt`
<steve_gh>
Can someone enlighten me pls
<companion_cube>
there is no propagation of that kind in the compiler; however you can use the pattern match above, as I explained
<companion_cube>
oh wait, you try to return only the first and last elements?
<steve_gh>
yep
<companion_cube>
[hh;tt] or hh::tt::[]
sternenseemann has joined #ocaml
<companion_cube>
but still, `let tt::_ = List.rev x` will trigger a warning, because it's non trivial to infer that `List.rev x` is non empty from the fact that `x` is non empty
ygrek has joined #ocaml
<chelfi>
hh::[tt] works too
<companion_cube>
oh yeah, my bad; it's so weird that I thought it was ill-typed
<steve_gh>
thxs
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<Kakadu>
Folks, I want to set OCAMLPATH variable to get more packages accessible but I'm doing something wrong. http://paste.in.ua/1715/#16
khodzha has quit [Remote host closed the connection]
khodzha1 has quit [Remote host closed the connection]
ygrek has quit [Ping timeout: 260 seconds]
slash^ has joined #ocaml
<Kakadu>
Ah, got it
<Kakadu>
It looked for ..../_build/packagename
rand__ has joined #ocaml
scarygelatin has joined #ocaml
M-pesterhazy has joined #ocaml
M-Illandan has joined #ocaml
Fleurety has joined #ocaml
Orion3k has joined #ocaml
octachron has quit [Quit: Page closed]
Sorella has joined #ocaml
wiredsister has quit [Ping timeout: 258 seconds]
jwatzman|work has quit [Quit: jwatzman|work]
larhat has quit [Quit: Leaving.]
demonimin has quit [Remote host closed the connection]
demonimin has joined #ocaml
tane has quit [Ping timeout: 258 seconds]
tane has joined #ocaml
shinnya has joined #ocaml
manizzle has quit [Ping timeout: 240 seconds]
martinkl_ has joined #ocaml
sepp2k has quit [Quit: Leaving.]
sepp2k has joined #ocaml
connorjacobsen has joined #ocaml
martink__ has joined #ocaml
martinkl_ has quit [Ping timeout: 250 seconds]
octachron has joined #ocaml
martink__ has quit [Client Quit]
darkf has joined #ocaml
copy` has quit [Quit: Connection closed for inactivity]