cjeris changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/
Ashen has left #ocaml []
nuncanada has quit [Read error: 104 (Connection reset by peer)]
nuncanada has joined #ocaml
dark_light has quit [Remote closed the connection]
TheArthur has joined #ocaml
dark_light has joined #ocaml
Naked has joined #ocaml
Hadaka has quit [Read error: 111 (Connection refused)]
Naked is now known as Hadaka
mbishop has quit ["Leaving"]
fezsentido has joined #ocaml
Nutssh has joined #ocaml
nuncanada has quit [Read error: 110 (Connection timed out)]
Smerdyakov has quit ["Leaving"]
malc__ has joined #ocaml
Smerdyakov has joined #ocaml
malc_ has quit [Read error: 110 (Connection timed out)]
mbishop has joined #ocaml
dark_light has quit [Client Quit]
dark_light has joined #ocaml
pants1 has quit [Remote closed the connection]
pants1 has joined #ocaml
pants1 has quit [Remote closed the connection]
pants1 has joined #ocaml
malc__ has quit ["leaving"]
bluestorm has joined #ocaml
pango has quit [Excess Flood]
bluestorm has quit ["Konversation terminated!"]
pango has joined #ocaml
Smerdyakov has quit ["Leaving"]
johnnowak has joined #ocaml
levi_ has joined #ocaml
levi_home has quit [Read error: 104 (Connection reset by peer)]
levi_ is now known as levi_home
chealer has joined #ocaml
vorago has joined #ocaml
chealer has quit ["Konversation terminated!"]
pango has quit [Remote closed the connection]
benny has joined #ocaml
benny_ has quit [Read error: 60 (Operation timed out)]
johnnowak has quit [Read error: 110 (Connection timed out)]
pango has joined #ocaml
chealer has joined #ocaml
<chealer>
hi. is there an equivalent of extlib's Option.get which doesn't need matching? (when extlib cannot be relied on)
<chealer>
uh, sorry
<chealer>
I'm only talking about the case where it's Some x
<chealer>
i.e. I have a variable which is a Some x and I want to get the x
<flux>
chealer, well, it's simple to write?
<flux>
let option_get = function Some x -> x | None -> failwith "option_get: None"
<chealer>
flux: yes, but I don't need the None -> case, so I would have to match with a single case. isn't that abnormal?
<flux>
chealer, the compiler produces a warning from that
<flux>
chealer, you might just go ahead and handle the case with failwith :)
<flux>
if you disable the warning, you can use: let (Some x) = foo in ..
<chealer>
flux: it would be easy like that, but I only know that it's a Some in a part of the function, so I can't use the "function header". (because I get Exception: Match_failure, which is actually my current problem)
<chealer>
a let...OK, that seems the best
<flux>
I don't see how avoiding a function call is going to solve your problem..
<chealer>
flux: you mean avoiding to use option_get?
<flux>
yes
<chealer>
flux: oh, you're right
<chealer>
flux: thank you.
Submarine has quit ["Leaving"]
love-pingoo has joined #ocaml
zmdkrbou_ has joined #ocaml
jlouis_ has quit [Remote closed the connection]
zmdkrbou has quit [Nick collision from services.]
zmdkrbou_ is now known as zmdkrbou
smimou has joined #ocaml
ikaros has joined #ocaml
ikaros has quit ["segfault"]
dark_light has quit [Read error: 110 (Connection timed out)]
eradman has quit [zelazny.freenode.net irc.freenode.net]
Mr_Awesome has quit ["...and the Awesome level drops"]
slipstream-- has joined #ocaml
slipstream has quit [Read error: 60 (Operation timed out)]
eradman has joined #ocaml
rickardg has joined #ocaml
Z4rd0Z has joined #ocaml
jlouis has joined #ocaml
<flux>
hmm, I managed to get a segmentation fault with libevent-ocaml, I wonder how robust the bindings are..
<flux>
(bytecode, too)
<flux>
in free
love-pingoo has quit ["Leaving"]
<flux>
on another host I get: *** glibc detected *** free(): invalid pointer: 0xb7e2a15c ***
<flux>
not very promising
<flux>
I suppose it could be a libevent bug
<flux>
does anyone know of projects that use libevent? has it been proven to be stable?
<flux>
uh, tons of applications depend on the libevent itself, so it's reasonable to assume it's stable
pango has quit [Remote closed the connection]
<flux>
it segfaults with the latest version of libevent too
pango has joined #ocaml
rickardg has quit ["ERC Version 5.2 stable pre-release (IRC client for Emacs)"]
<flux>
with gc debugging, it strangely says 'Starting new major GC cycle' just before the crash, and before exiting..
<flux>
actually it just gets stuck, hm, I wonder if it 'fixed' it
<flux>
hm, if I'm lucky, it's because some resource is actually running out!
<flux>
(my end-of-day monologue..)
vital303 has joined #ocaml
jer has quit [Read error: 145 (Connection timed out)]
visage has joined #ocaml
<visage>
does anyone have experience binding ocaml to another function language ... like erlang?
<visage>
I would like to use Erlang's concurrent abilities for distributed programming -- but I also want to take advantage of OCaml's typing system to develop an expression based DSL ...
<visage>
And then somehow mash the two together...
<flux>
visage, that's exactly what I talked about in the channel a few days back.. but sadly, I don't think such projects exist
<flux>
only even in the same neighborhood is the perl4caml
<visage>
ah, bummer.
<visage>
the erlang guys recommended just using sockets for communication -- but I think that is sort of unnecessary.
<flux>
related to my problems with libevent: removing a call to stat_free removed the problem, but apparently it leaks now.. what does the function do? the documentation doesn't say.
<flux>
I'm thinking it needs to be paired with stat_alloc, which isn't called..
Submarine has joined #ocaml
<flux>
but the test app keeps on growing without it - with it it doesn't keep up long enough to see
love-pingoo has joined #ocaml
Smerdyakov has joined #ocaml
pango- has joined #ocaml
<slacker403>
i think i am going to use ocaml on my embedded ystem
jer has joined #ocaml
gim has joined #ocaml
fremo has quit [Read error: 60 (Operation timed out)]
pango has quit [Remote closed the connection]
pango- is now known as pango
chealer has quit ["Konversation terminated!"]
fasta has joined #ocaml
<fasta>
What does this syntax mean in ML (SET{root,...})?
<flux>
hm, that doesn't look valid ocaml to me..
<mrvn>
the () mean nothing. SET is a constrcutor and { } would be a record. But record are created with {label=val; label=val;}
swater has joined #ocaml
<flux>
you need () to set precedency,
<jacobian>
looks like matching syntax
<jacobian>
case x of (SET{root,...}) => root
<mrvn>
flux: To your problem. Call Gc.compact () before your function and it should crash again. If it does then you are passing a pointer to an ocaml block to the C code and the GC moves it around.
<mrvn>
jacobian: no case, ocaml has match x with
<jacobian>
he said ML
<jacobian>
which could mean anything
<mrvn>
yeah, just saying.
<mrvn>
Maybe more context would show what is ment.
<fasta>
By ML I meant a module with .ml as extension, and AFAIK it's what jacobian said.
<fasta>
Thanks
love-pingoo has quit ["Connection reset by pear"]
vital303 has quit ["Leaving."]
fasta has quit ["leaving"]
slipstream-- has quit [Read error: 110 (Connection timed out)]
slipstream has joined #ocaml
Nutssh has quit [Remote closed the connection]
Nutssh has joined #ocaml
malc_ has joined #ocaml
swater has quit ["Quat"]
visage has quit []
<bsmith>
why does -1 + -1 evaluate properly, but not (+) -1 -1 ?
<Smerdyakov>
There's no possibility for ambiguity in the first.
<bsmith>
makes sense, thanks
<mrvn>
Why can't it be ((((-) 1) (+)) (-)) 1?
<Smerdyakov>
Should have said no possibility for certain ambiguities.
<mrvn>
I can see why the first - gets seen a negative. But why the second?
<Smerdyakov>
Though your example is clearly invalid, because of the way operators are parsed in OCaml.
<Smerdyakov>
An operator not in parentheses can't be treated as a standalone syntactic element.
<mrvn>
So you have <negative>(1) <infix +> '-' (1)
<mrvn>
What makes the '-' an negative instead of <infix ->?
<Smerdyakov>
I don't know.
<Smerdyakov>
I prefer SML's approach, where ~ is the negation operator.
<mrvn>
I guess <infix -> can only follow an expression and '-1 +' is only half one.
Z4rd0Z has quit []
jlouis_ has joined #ocaml
jlouis has quit [Read error: 60 (Operation timed out)]
pango has quit [Remote closed the connection]
pango has joined #ocaml
Oyd1111 has joined #ocaml
<pango>
ocaml's negation operators are ~- for ints and ~-. for floats... at least there's some consistency ;)
<Smerdyakov>
I don't understand. I write - for int negation.
<Smerdyakov>
I guess it's special syntactic sugar?
<pango>
# ~-1 ;;
<pango>
- : int = -1
<pango>
# (+) ~-1 ~-1 ;;
<pango>
- : int = -2
<Smerdyakov>
# -1 ;;
<Smerdyakov>
- : int = -1
<pango>
yes, -1 must be treated specially when it's unambiguous, I guess
<mattam>
Didn't know about ~-, is it new ?
<pango>
Or ~-1 is really ( ~- ) 1, which is not the same thing as -1
<pango>
mattam: afaik no, it's been there for ages
<pango>
# (+) ~- 1 ~- 1 ;;
<pango>
- : int = -2
<Smerdyakov>
And this works:
<Smerdyakov>
# let x = 7;;
<Smerdyakov>
val x : int = 7
<Smerdyakov>
# -x;;
<Smerdyakov>
- : int = -7
<pango>
so - is either difference or negation, depending on context... :/
<Smerdyakov>
pango, so do you agree that SML does it better?
<pango>
don't know what SML does exactly, but it's probably less messy than that ;)
joshcryer has quit [Client Quit]
<mbishop>
Speaking of, people really enjoyed your Ocaml vs SML comparison on reddit, Smerdyakov
<Smerdyakov>
Well, how about that. Maybe reddit isn't low culture, after all. ;)
<Smerdyakov>
mbishop, have a URL to proof of enjoyment?