rwmjones has quit [Read error: Operation timed out]
emmanuelux has quit [Remote host closed the connection]
\rs has left #ocaml []
rwmjones has joined #ocaml
yacks has joined #ocaml
tane has quit [Quit: Verlassend]
jamii has quit [Quit: Leaving]
ulfdoz_ has joined #ocaml
ulfdoz has quit [Read error: Operation timed out]
ulfdoz_ is now known as ulfdoz
adotbrown has quit [Ping timeout: 245 seconds]
madroach has quit [Ping timeout: 248 seconds]
adotbrown has joined #ocaml
madroach has joined #ocaml
groovy2shoes has joined #ocaml
zenogais has quit [Ping timeout: 260 seconds]
gnuvince has joined #ocaml
rwmjones has quit [Read error: Operation timed out]
rwmjones has joined #ocaml
_eko has joined #ocaml
lusory has quit [Quit: leaving]
zenogais has joined #ocaml
zenogais has quit [Remote host closed the connection]
clog has joined #ocaml
dabd has quit [Ping timeout: 255 seconds]
wormphlegm has quit [Read error: Operation timed out]
adotbrown has quit [Ping timeout: 264 seconds]
andreypopp has quit [Quit: sleep]
andreypopp has joined #ocaml
silkwood has quit [Ping timeout: 252 seconds]
answer_42 has joined #ocaml
ttamttam has joined #ocaml
andreypopp has quit [Quit: sleep]
andreypopp has joined #ocaml
andreypopp has quit [Quit: sleep]
alxbl has quit [Ping timeout: 256 seconds]
alxbl has joined #ocaml
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
Cyanure has joined #ocaml
chambart has joined #ocaml
<tac>
types
<tac>
TDJACR: ^
darkf has quit [Read error: Connection reset by peer]
darkf has joined #ocaml
adotbrown has joined #ocaml
hyperboreean has quit [Ping timeout: 245 seconds]
adotbrown has quit [Ping timeout: 245 seconds]
Kakadu has joined #ocaml
Yoric has quit [Remote host closed the connection]
Yoric has joined #ocaml
<flux>
sadly that sounds too much of a homework assignment for me to even try :(
gour has joined #ocaml
andreypopp has joined #ocaml
hyperboreean has joined #ocaml
ontologiae has joined #ocaml
Cyanure has quit [Remote host closed the connection]
ftrvxmtrx_ has joined #ocaml
djcoin has joined #ocaml
ontologiae has quit [Ping timeout: 245 seconds]
andreypopp has quit [Quit: sleep]
hkBst has quit [Read error: Connection reset by peer]
hkBst has joined #ocaml
andreypopp has joined #ocaml
Cyanure has joined #ocaml
mika1 has joined #ocaml
cago has joined #ocaml
ocp has joined #ocaml
tac has quit [Quit: Page closed]
tane has joined #ocaml
ontologiae has joined #ocaml
skow has joined #ocaml
<skow>
hi guys, something which I don't quit understand, what's the point of type 'unit'?
<invariant>
skow, it's to indicate that something is done only for its side-effect.
<skow>
the operation on it is even more confusing -
<PM>
skow: in ocaml, everything is a value
<skow>
() ; () = ()
<skow>
what is the operation for?
<PM>
thus, when you don’t need a value, you return a unit value
<invariant>
skow, what operation?
<skow>
the semicolon, the only operation for unit
<invariant>
; is not an operation.
<invariant>
It's syntax.
<invariant>
It just tells to sequence the preceding phrases (as I believe is the correct term).
<invariant>
Or expressions more simply (and perhaps incorrect).
<skow>
in the lecture it says "operation on the unit"
<invariant>
So, the only thing that happens is: first evaluate () and then evaluate ()
<invariant>
A compiler will compile this to do nothing at all in zero time.
<invariant>
skow, who is your lecturer?
<flux>
; can be considered to be an operator 'a -> 'b -> 'b
<invariant>
flux, that's mostly when you would be implementing the language.
ahokaomaeha has quit [Ping timeout: 252 seconds]
<pippijn>
I think that's also useful for understanding the language
<flux>
skow, unit typically appears when functions have side effects instead of (or in addition to) arguments and return values
<pippijn>
unit is also useful when using labelled arguments
<flux>
skow, but they can appear in other contexts as well. consider you have a map type that associates elements of some type to elemnts of some type (possibly the same type or another)
<flux>
skow, but now you have an algorithm that doesn't require maps, but it can use sets
<flux>
so what should the second type be? unit is an obvious choice
<flux>
you can still check if the map contains a certain key
<flux>
(ocaml has sets in addition to maps, though)
<pippijn>
maybe unit is like java's java.lang.Void
<flux>
((but I've used that approach in my own map-like data structures for getting a map-like data structure: you get a datastructure for "free"))
<pippijn>
for getting a set-like data structure
<flux>
oops, right
<flux>
and of course, then you can use the same technique for implementing booleans when you have the implementation for set.
<pippijn>
a partially related question: which argument order makes more sense or in what situations does one order make more sense: Map's or Hashtbl's order?
<skow>
alright, got it. Thank you guys!
<pippijn>
Map.add and Hashtbl.add
<pippijn>
Map.add: key -> 'a -> 'a t -> 'a t
<flux>
I think I prefer Hashtbl's order
<flux>
but may end up using Map's order for consistency
<invariant>
pippijn, labeled arguments and ()?
<pippijn>
Hashtbl.add : ('a, 'b) t -> 'a -> 'b -> unit
<flux>
maybe there is some great thoughts about the order like 'in mutable data structures the mutated value comes first', but then how about Queue?
<pippijn>
I think it's related to mutation, yes
<pippijn>
but indeed.. queue
<flux>
I think it makes sense to have the 'interesting' data structure as the first argument.
<flux>
but the current order can be useful with folds
<flux>
where you convert a list to a set, for example
<pippijn>
because you can do this sensibly for Hashtbl: let add = Hashtbl.add table in add 1 true; add 2 false; ...
<pippijn>
ah yeah, folds
<skow>
Geez.. For someone who has done some imperative programming in the past and was extremely clueless about functional programming and thought algorithm books were boring...
<skow>
ocaml changed me
<skow>
I just started but having so much fun, it makes learning algorithm fun lol
<skow>
and easy
thomasga has joined #ocaml
UncleVasya has joined #ocaml
andreypopp has quit [Quit: sleep]
SanderM has joined #ocaml
andreypopp has joined #ocaml
_andre has joined #ocaml
ousado has quit [*.net *.split]
cross has quit [*.net *.split]
ousado has joined #ocaml
cross has joined #ocaml
chambart has quit [Ping timeout: 246 seconds]
yacks has quit [Ping timeout: 248 seconds]
UncleVasya has quit [Ping timeout: 264 seconds]
gour_ has joined #ocaml
gour has quit [Disconnected by services]
skow has quit [Ping timeout: 245 seconds]
hkBst has quit [Remote host closed the connection]
mye has joined #ocaml
hkBst has joined #ocaml
myx has joined #ocaml
ontologiae has quit [Ping timeout: 246 seconds]
yacks has joined #ocaml
leoncamel has joined #ocaml
skow has joined #ocaml
<skow>
geez.. it seems like shift + \ crashed ocaml repl lol
<skow>
sorry
<skow>
I mean ctrl + \
<flux>
it's a standard unix feature
<flux>
same as ctrl-4
<flux>
(and similar as ctrl-c)
<skow>
ermm ctrl-c doesn't give core dump
<flux>
similar, not the same
<flux>
ctrl-\ or ctrl-4 sends the quit-signal
<flux>
ctrl-c sends the intr-signal
<flux>
unless you specifically reconfigure the terminal to not do that
<flux>
stty quit ''; rlwrap ocaml
<flux>
you can try that with, say, cat
<flux>
(or python)
<skow>
okie dokie, thanks!
<flux>
happy repling ;)
ontologiae has joined #ocaml
tane has quit [Quit: Verlassend]
mcclurmc has quit [Ping timeout: 264 seconds]
ttamttam has quit [Quit: ttamttam]
ttamttam has joined #ocaml
_andre has quit [Quit: Lost terminal]
ttamttam has quit [Quit: ttamttam]
chambart has joined #ocaml
dabd has joined #ocaml
osa1 has joined #ocaml
<osa1>
is there a way to suppress pattern matching warnings ? I'm matching against `compare ...` and getting warnings about unmatched 2
_andre has joined #ocaml
<flux>
well, you can add a catch-all rule, like | _ -> assert false
<osa1>
flux: is that only solution ? I was looking for some kind of annotation/compiler parameter
<flux>
well, there is a syntax extension for unrefutable pattern matching, but I haven't used it for quite a long time
<flux>
pa_refutable.ml
groovy2shoes has joined #ocaml
<osa1>
does ocaml give a warning for overlapping patterns ?
<flux>
yes
<osa1>
and it's enabled by default ?
<flux>
yes
<osa1>
ok thanks. I'm looking for a bug in my code
<companion_cube>
err, overlapping patterns?
<flux>
of course, it won't work if you have guard matches
<osa1>
flux: do you mean | ... when ... ?
<companion_cube>
or _, right?
<flux>
osa1, yes
<flux>
companion_cube, well, it works but _ is sort of a special case, it's ok if it's last
<companion_cube>
oh, I see
<flux>
osa1, it gives a safe warnings, though
<flux>
actually hmm, I wonder how _ and guards work together in that case
ttamttam has joined #ocaml
<flux>
I was wrong, this doesn't warn: type a = A | B let f a = match a with | A, B when true -> () | A, B -> () | _ -> ()
<flux>
it does warn if you remove the guard
rwmjones has quit [Read error: Operation timed out]
<flux>
I'm guessing if you have a guarded pattern, for the purposes of the warning it is as if it didn't exist
deavidsedice has quit [Ping timeout: 240 seconds]
justinfront_ has joined #ocaml
<justinfront_>
Hi if I want to call a terminal command from ocaml how would I do that eg... let revision =
<invariant>
How can one debug a complete OCaml program with C bindings?
<pippijn>
with gdb
<pippijn>
and printf
<invariant>
pippijn, I would like handholding instructions for gdb + OCaml.
<pippijn>
I don't have them
<invariant>
pippijn, I can use gdb, I can use OCaml, I cannot use both together.
<pippijn>
using gdb to debug ocaml code is not easy
deavid has joined #ocaml
andreypopp has quit [Quit: sleep]
<invariant>
Haven't they had like 20+ years to implement a debugger?
<pippijn>
better use the ocaml debugger
<pippijn>
with byte code
<invariant>
pippijn, also when it crashes in C code?
<pippijn>
no
<pippijn>
then you use gdb
<pippijn>
because then you have debug symbols for your C code
<invariant>
(in that case, I would like to see something like a backtrace which then says ocamlfun1...ocamlfun2 (with all arguments) ... cfun1... BOOM.
rwmjones has joined #ocaml
<pippijn>
yes
<pippijn>
it does that
<invariant>
pippijn, the ocaml byte code debugger?
<pippijn>
gdb
<invariant>
pippijn, how do I compile everything in opam with debugging options?
<pippijn>
I don't know opam
<invariant>
I don't see why not everything is done by default with all debugging options.
<invariant>
It's not like it won't run fast enough otherwise.
<pippijn>
what happens when you use gdb?
<invariant>
pippijn, the backtrace I got only has numbers in it.
<invariant>
pippijn, or addresses
<pippijn>
can I see?
<invariant>
pippijn, #<#> 0x<address> ??
<invariant>
pippijn, you won't see anything in it, I think.
<pippijn>
ok
groovy2shoes has quit [Quit: Computer has gone to sleep]
myx has quit [Ping timeout: 240 seconds]
myx has joined #ocaml
andreypopp has joined #ocaml
<invariant>
What does $foo mean in OCaml?
<pippijn>
where do you see that?
justinfront_ has quit [Quit: ChatZilla 0.9.89 [Firefox 16.0.2/20121024073032]]
<invariant>
pippijn, opam source code opamMain.ml
<pippijn>
I don't know that file
<invariant>
pippijn, find -name opamMain.ml does.
cdidd has quit [Quit: Leaving]
<pippijn>
pippijn@anubis ~ $ locate opamMain.ml
<pippijn>
pippijn@anubis ~ $
<pippijn>
no, sorry
<invariant>
pippijn, it's in the git repo.
<invariant>
pippijn, and yes, it is there.
<pippijn>
ok
<pippijn>
my time is extremely limited, so I'm not going to look for it
groovy2shoes has joined #ocaml
groovy2shoes has quit [Client Quit]
cago has left #ocaml []
mika1 has quit [Quit: Leaving.]
mcclurmc has joined #ocaml
Kakadu has quit []
Kakadu has joined #ocaml
mcclurmc has quit [Ping timeout: 276 seconds]
osa1 has quit [Quit: Page closed]
pango is now known as pangoafk
ftrvxmtrx_ has quit [Quit: Leaving]
travisbrady has joined #ocaml
myx has quit [Ping timeout: 245 seconds]
darkf has quit [Quit: Leaving]
nimred has quit [Quit: leaving]
jamii has joined #ocaml
hkBst has quit [Remote host closed the connection]
hkBst has joined #ocaml
hkBst has quit [Changing host]
hkBst has joined #ocaml
metasyntax has joined #ocaml
Kakadu has quit []
myx has joined #ocaml
fasta has quit [Ping timeout: 245 seconds]
hkBst has quit [Quit: Konversation terminated!]
smondet has joined #ocaml
andreypopp has quit [Quit: sleep]
pangoafk is now known as pango
andreypopp has joined #ocaml
tane has joined #ocaml
ocp has quit [Ping timeout: 245 seconds]
andreypopp has quit [Ping timeout: 255 seconds]
andreypopp has joined #ocaml
travisbrady has quit [Quit: travisbrady]
Cyanure has quit [Remote host closed the connection]
SanderM has quit [Read error: Connection reset by peer]
travisbrady has joined #ocaml
ttamttam has quit [Quit: ttamttam]
andreypopp has quit [Quit: sleep]
clan has quit [Remote host closed the connection]
myx has quit [Ping timeout: 245 seconds]
tac has joined #ocaml
<thomasga>
invariant: ($) is an operator in cmdliner