umod has quit [Read error: 104 (Connection reset by peer)]
donny_ has joined #ocaml
jlouis_ has joined #ocaml
<fbvortex>
If I try the code segment at: http://pastebin.com/m4f97bc7b , I get a syntax error and it seems related to the presence of the guard condition
<fbvortex>
this is an example of what I was trying to get at with my earlier match question.
<fbvortex>
is there something wrong in principle with the match in that code?
<thelema>
only one 'when' clause per ->
<thelema>
match x with cond1 | cond2 when test -> 1 -- OK
<thelema>
match x with cond1 when test1 | cond2 when test2 -> 1 -- NOT OK
<fbvortex>
thelema: OK, thanks.
Linktim has quit [Remote closed the connection]
jlouis has quit [Connection timed out]
jlouis_ is now known as jlouis
Tetsuo has quit ["Leaving"]
AxleLonghorn has quit ["Leaving."]
jlouis_ has joined #ocaml
jlouis has quit [Connection timed out]
eu-prleu-peupeu has joined #ocaml
<eu-prleu-peupeu>
hey
<eu-prleu-peupeu>
is OCaml better than Haskell ?
<hcarty>
Yes!
<hcarty>
Though, to be fair, the opinions in here may be rather biased
<hcarty>
And better will likely depend on what you want to use it for
coucou747 has quit ["bye ca veut dire tchao en anglais"]
<thelema>
eu-prleu-peupeu: is a spoon better than a fork?
<eu-prleu-peupeu>
:D
<eu-prleu-peupeu>
hehehe
<eu-prleu-peupeu>
do you think OCaml will rule the world of computer languages ?
goalieca has joined #ocaml
<thelema>
no, it's too difficult for an average/below-average programmer to use.
<thelema>
:)
<eu-prleu-peupeu>
that means that all OCaml coders are l33t ?
<thelema>
no, just above average.
<eu-prleu-peupeu>
ah ok
<hcarty>
OCaml is less different from "other" languages (C, Java, etc) than Haskell, but still quite different
wy has quit [Read error: 110 (Connection timed out)]
rogo has joined #ocaml
eu-prleu-peupeu has left #ocaml []
Morphous has joined #ocaml
petchema has quit [Read error: 113 (No route to host)]
ita has quit [Remote closed the connection]
Amorphous has quit [Read error: 110 (Connection timed out)]
hkBst has quit ["Konversation terminated!"]
hasone_ has quit [Remote closed the connection]
ecc has quit ["leaving"]
wy has joined #ocaml
jlouis has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
goalieca has quit [Remote closed the connection]
TheLittlePrince has joined #ocaml
TheLittlePrince has quit [Client Quit]
TheLittlePrince has joined #ocaml
jlouis has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
a13x has joined #ocaml
<a13x>
question: can you pass object members as function arguments?
__suri has joined #ocaml
<thelema>
a13x: object members like values or methods?
<thelema>
you can pass any ocaml value as a function argument, so encapsulating whatever you want as a functional value (to pass as argument) should work for any situation.
<a13x>
what do you mean by "encapsulating"
<thelema>
(fun arg -> obj#method arg)
<a13x>
when would the method be executed?
<a13x>
i have this: GMain.Timeout.add ~ms:100 ~callback:(fun _ -> (print_string "."; idle_func (); true)
<thelema>
okay, every 100 ms idle_func gets called...
<a13x>
for some reason it doen't work
<a13x>
idle_func is a member
<thelema>
does . get printed?
<a13x>
yes but not the print statement inside idle_func
<thelema>
idle_func is a member of what?
<a13x>
member of another class
<thelema>
do you have a function called idle_func as well?
<Yoric[DT]>
If I understand correctly the error message, it's a typing problem : you can't just write "self" at that point because "self" doesn't have a type yet.
<Yoric[DT]>
Note that you probably don't need "self" at all there.
<a13x>
no, i do
<a13x>
i will rewrite the thing without classes
<a13x>
should help
<Yoric[DT]>
ok
Tetsuo has joined #ocaml
goalieca_lappy has quit ["sleep"]
Demitar has quit ["Burn the land and boil the sea. You can't take the sky from me."]
Demitar has joined #ocaml
Demitar has quit [Read error: 104 (Connection reset by peer)]
Demitar has joined #ocaml
<flux>
yoric[dt], maybe lazy evaluation could help
<flux>
I mean a13x
<flux>
.. = lazy (new ui ..) and later refer to ui with Lazy.force ui..
middayc____ has joined #ocaml
middayc____ is now known as middayc
middayc has quit [Client Quit]
middayc____ has joined #ocaml
middayc____ is now known as middayc
love-pingoo has joined #ocaml
coucou747 has joined #ocaml
a13x has quit [Read error: 113 (No route to host)]
benzo has quit [Read error: 104 (Connection reset by peer)]
LordMetroid has joined #ocaml
benzo has joined #ocaml
Linktim_ has joined #ocaml
Morphous is now known as Amorphous
Linktim has quit [Read error: 110 (Connection timed out)]
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim_ has joined #ocaml
Linktim- has joined #ocaml
Linktim_ has quit [Read error: 110 (Connection timed out)]
Linktim- has quit [Read error: 110 (Connection timed out)]
gaja has joined #ocaml
marmottine has joined #ocaml
ben____ has joined #ocaml
ben____ is now known as ziph
Linktim- has joined #ocaml
middayc has quit []
Linktim- has quit [Read error: 110 (Connection timed out)]
middayc has joined #ocaml
Anarchos has joined #ocaml
zmdkrbou has quit [Read error: 113 (No route to host)]
bongy has joined #ocaml
Demitar has quit ["Burn the land and boil the sea. You can't take the sky from me."]
<Anarchos>
when i try to do 'make world', i get "/bin/sh: -o: command not found" in otherlibs/unix . The command launch begins with "../../boot/ocamlrun ../../tools/ocamlmklib -oc unix accept.o access.o addrofstr.o alarm.o bind.o c ......"
middayc has quit []
Linktim- has joined #ocaml
dwmw2_gone is now known as dwmw2_GVA
ita has joined #ocaml
zmdkrbou has joined #ocaml
Linktim- has quit [Read error: 110 (Connection timed out)]
bluestorm has joined #ocaml
<Anarchos>
is there someone awake here ?
<coucou747>
yes
<Anarchos>
coucou747 j'ai un prbm qd je recompile ocaml
<Smerdyakov>
Anarchos, IRC etiquette suggests that you not ask that.
<Anarchos>
Smerdyakov not to ask what ??
<coucou747>
Anarchos> here, we speak english, join #ocaml-fr to speak french
<coucou747>
Anarchos> il te demande de poser directement ta question, et de ne pas demander si tu peux la poser...
<Smerdyakov>
Anarchos, not to ask if anyone is awake, or if anyone can answer a question, etc..
<Anarchos>
coucou747 sorry i thought it was allowed. Let's do it in english thus
<coucou747>
ok :)
<Anarchos>
i can't build the unix library.
<Anarchos>
the shell command is not accepted by sh : ./../boot/ocamlrun ../../tools/ocamlmklib -oc unix accept.o access.o addrofstr.o alarm.o bind.o c ......"
<Anarchos>
i get "/bin/sh: -o: command not found"
middayc has joined #ocaml
dwmw2_GVA is now known as dwmw2_gone
bongy has quit ["Leaving"]
zenhacker_rouan has joined #ocaml
ofaurax has joined #ocaml
zenhacker_rouan has left #ocaml []
AxleLonghorn has joined #ocaml
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
Anarchos has joined #ocaml
ita has left #ocaml []
ttamttam has joined #ocaml
ttamttam has left #ocaml []
LordMetroid has quit ["Leaving"]
kotarak has joined #ocaml
Demitar has joined #ocaml
ttamttam has joined #ocaml
ttamttam has left #ocaml []
pango has quit [Remote closed the connection]
pango has joined #ocaml
Morphous has joined #ocaml
Amorphous has quit [Nick collision from services.]
Morphous is now known as amorphous
amorphous is now known as Amorphous
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
Madrok has left #ocaml []
kotarak has quit [":q!"]
hkBst has joined #ocaml
<thelema|away>
does anyone know of a way to do the equivalent of "#include pa_macro1" in camlp4?
thelema|away is now known as thelema
shortcircuit has quit ["Probably rebooting."]
<bluestorm>
thelema: at the camlp4-runtime level, "#load pa_macro1" should do the job
<bluestorm>
hmm
__suri has quit []
<thelema>
I'm interested in having that *inside* a .ml file.
<bluestorm>
you mean, at compilation time ?
<Smerdyakov>
thelema, the usual approach is to put the inclusion requests in a specially-formatted comment at the beginning of a file, with Makefile magic to interpret that.
<thelema>
i.e. something outside camlp4 has to take care of determining what camlp4 engines get applied... :(
<bluestorm>
why would camlp4 have to handle build system issues ?
<thelema>
One advantage of cpp over camlp4 is that the instructions on how to process are inside the file being processed.
<bluestorm>
i guess it would be feasible to create simple syntax extension, adding an e.g. #use_syntax directive, doing that
<bluestorm>
but it seems that the solutions i've seen so far (ie. using a specific comment as Smerdyakov said) are better in term of adaptability
<Smerdyakov>
That's the way Coq does it, and camlp4 was more or less invented to use to implement Coq. :-)
<thelema>
would a camlp4 extension be able to load other extensions?
<bluestorm>
hm
<bluestorm>
if those extensions were specifically created for this, yes it would
<bluestorm>
without any specific care, i think you'd have to use dynamic linking
<thelema>
because camlp4 extensions are programs, and not just data for the camlp4 program to use in processing its input.
<bluestorm>
yes but actually they're quite nealty packed into functors
<bluestorm>
it would be quite a hack, but i think it might even be possible to do that without changing the extension code (by mimicking the camlp4 extension registration mechanism)
hsuh has joined #ocaml
* thelema
puts that on his todo list
ofaurax has quit ["Leaving"]
kotarak has joined #ocaml
LordMetroid has joined #ocaml
ygrek has joined #ocaml
AxleLonghorn has left #ocaml []
|Catch22| has joined #ocaml
shortcircuit has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]
bluestorm has quit ["Konversation terminated!"]
marmottine has quit [Remote closed the connection]
marmottine has joined #ocaml
middayc_ has joined #ocaml
evn has joined #ocaml
evn has quit [Remote closed the connection]
AxleLonghorn has joined #ocaml
middayc has quit [Read error: 110 (Connection timed out)]
middayc_ has quit []
middayc has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
pango_ has quit [Remote closed the connection]
ita has joined #ocaml
middayc_ has joined #ocaml
evn has joined #ocaml
<neale>
module Timer_set = Set.Make (struct type t = timer let compare = compare end)
<neale>
type t = {timers: Timer_set.t ref}
<neale>
and timer = (float * (t -> float -> int))
<neale>
how can I do this?
middayc has quit [Read error: 110 (Connection timed out)]
<thelema>
how can you do what?
<Smerdyakov>
Tricky..
<Smerdyakov>
No doubt there's a way to do it with recursive modules.
<thelema>
module rec Timer = struct type t = {timers: Timer_set.t ref} type timer = float * (t -> float -> int) let compare = compare end and Timer_set = Set.make(Timer)
<thelema>
pango: it says "A typical example of a recursive module definition is: <code> It can be given the following specification: <code>" -- it doesn't seem required to give a spec.
<pango>
not sure why it does work with signatures then, but the line you posted doesn't compile for me (syntax error)
<pango>
(ocaml 3.10.0)
<thelema>
pango: I more likely forgot a bit of syntax... maybe if I break it up across multiple lines properly
<thelema>
ah, I typed "Set.make" instead of "Set.Make"
<pango>
yes, I changed that
<thelema>
still broken after that change?
<pango>
yes
<pango>
when the syntax error is reported, the first = (after module rec Timer) is underlined... that's one more reason why I thought signature was expected
<thelema>
oh, you're right... I didn't look at the example enough...
<thelema>
you have to specify the signatures for all recursive modules inline.
<thelema>
module rec Timer : sig type t = {timers: Timer_set.t ref} type timer = float * (t -> float -> int) val compare : t -> t -> int end = struct type t = {timers: Timer_set.t ref} type timer = float * (t -> float -> int) let compare = compare end and Timer_set : Set.S with type elt=Timer.t = Set.Make(Timer)
<neale>
you just blew my mind again
<pango>
thelema: actually I wonder if that "restriction" is not something new in this experimental feature... will have to check in older revisions of the reference manual...
<neale>
okay my daughter woke up but now I can try to put my mind back together
<thelema>
it's just a huge block of unformatted code, 1/3 of chich repeats twice.
<thelema>
pango: if you're doing recursive modules, it's probably good to give the type checker as much of a head start as possible.
<pango>
thelema: yes, this restriction could have been added to "fix" some difficult cases... on the other hand, it could just be that my memory is faulty and that this restriction was there from the beginning...
<pango>
Objective Caml 3.07: Language features: - Experimental support for recursive module definitions module rec A : SIGA = StructA and B : SIGB = StructB and ...
<pango>
(from changelog)
ziph has quit []
<thelema>
yup, from the beginning the sigs are needed.
<neale>
thelema: I have no idea what is happening there
coucou747 has quit ["bye ca veut dire tchao en anglais"]
<thelema>
4 pieces: the signauture of Timer, the struct of Timer, the sig of Timer_set, the struct of timer_set.
<neale>
the signature of Timer_set is Set.S?
<thelema>
Set.S with elt=Timer.t
<thelema>
oops, Set.S with type elt=Timer.t
coucou747 has joined #ocaml
Linktim_ has joined #ocaml
evn has quit []
Linktim has quit [Read error: 110 (Connection timed out)]
ttamttam has joined #ocaml
ttamttam has left #ocaml []
Linktim_ has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has quit [Read error: 113 (No route to host)]
Anarchos has joined #ocaml
<Anarchos>
when i build dllunix.so, it doesn't link with libcamlrun. what did i miss in the makefiles ?
<thelema>
Anarchos: what platform?
<Anarchos>
hummm beos (sorry)
<thelema>
Anarchos: ocamlrun doesn't do the linking, ocamlmklib does...
<Anarchos>
thelema yes but it is not done !! i copied the options for mksharedlibs from the linux ones though
<thelema>
your compile does the ocamlmklib -o unix (large list of .o files in unix directory)?
<thelema>
(after compiling write.c)
ygrek has quit [Remote closed the connection]
<Anarchos>
wait a minute i will copy the start of this line
<mbishop>
I was wondering because someone on reddit was saying ocaml can't do heterogeneous types
<flux>
I suppose that would require require weak hash tables or something that go in the background
<mbishop>
in comparison with Ruby (haha oh wow)
<Anarchos>
thelema i know : it is for supporting dynlink
<flux>
well, it can't, lists are always sequences of a certain static type
<flux>
you can simulate the effect, though
<mbishop>
right, which is what I was asking heh, ways to simulate it
<thelema>
Anarchos: that command fails, or that command doesn't produce the correct output
<thelema>
mbishop: variant types are the right way to simulate heterogenous lists.
<flux>
thelema, but it's not the same
<flux>
thelema, you need to define the types of a variant type in one place
<mbishop>
thelema: got an example?
<thelema>
which is (more or less) what languages with a universal type basically do under the covers.
<thelema>
flux: if you don't want to define types, use a polymorphic variant
<flux>
thelema, yeah, I was thinking that, but I wonder how nicely you would implement that..
<flux>
although I'd also like to see a case where one really wants to have such narrowed types in a list
<thelema>
oops, n/m, you still have to define a nice type for the polymorphic variant, *and* do some casting...
a13x has joined #ocaml
<Anarchos>
thelema why ? What is the problem ?
<flux>
but then again, at times your design really calls for casting a child class back to a parent class, and doing that requires going through hoops in ocaml ;)
<thelema>
Anarchos: two conversations going on here. my message to you should have been an either/or question.
<Anarchos>
thelema ok sorry
<flux>
any comments on narrow.ml{,i}, would anyone find it useful?-)
<mbishop>
I mentioned that tuples allow for type mixing in a set or group or whatever the proper mathematical term is :P
<thelema>
flux: casting to parent seems easy.
<thelema>
mbishop: tuples allow for type mixing, as long as you know how many things you're mixing.
<flux>
thelema, with objects? impossible, without a hash table that has an explicit mapping from child objects to parents?
<thelema>
technically, tuples are just arrays where you're allowed to have different types within (and the type checker keeps track of those types)
<thelema>
flux: (obj :> parent_type) ?
<flux>
thelema, hrmh, obviosuly I meant the other way :-)
<thelema>
feh. The other way can't be performed in general.
<flux>
akin to a dynamic typing use case..
<thelema>
if you have dynamic typing, you basically have a universal type, and *all* your objects are tagged.
<thelema>
all your variables too.
<flux>
yes, but the tagging is distributed
<thelema>
even the number 3 gets tagged - as a number.
<flux>
but I think narrow.ml gets quite close to the effect. it has explicit, dynamically allocated, tags
<flux>
(and it overflows the counter too, so it won't work for long ;-))
<thelema>
there's no syntactic overhead on the tagging, and the possibilities are built into the compiler (modulo composite types), but what do you mean by distribution?
<thelema>
flux: just switch to a 128-bit counter -- that won't overflow.
<flux>
let's say I wanted to have a universal type in ocaml
<flux>
how would you write it?
<flux>
..now, how would you add record and object types to it..