mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.0 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
jhome has quit [Read error: 104 (Connection reset by peer)]
jhome has joined #ocaml
wy has joined #ocaml
Morphous has joined #ocaml
bluestorm_ has quit ["Konversation terminated!"]
Amorphous has quit [Connection timed out]
yminsky has joined #ocaml
yminsky has quit [Client Quit]
wy__ has joined #ocaml
wy__ has quit [Read error: 104 (Connection reset by peer)]
crathman has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
hkBst has quit ["Konversation terminated!"]
seafood_ has quit []
yminsky has joined #ocaml
keisukefukuda has quit [Read error: 110 (Connection timed out)]
crathman has quit [Connection reset by peer]
crathman has joined #ocaml
__suri has quit []
__suri has joined #ocaml
keisukefukuda has joined #ocaml
keisukefukuda has quit [Client Quit]
yminsky has quit []
crathman_ has joined #ocaml
crathman has quit [Read error: 104 (Connection reset by peer)]
crathman_ is now known as crathman
<wy> I wonder which one is better, "The Objective Caml System" or "Developing Applications with Objective Caml"?
yminsky has joined #ocaml
<wy> yminsky: Hello
yminsky has quit []
piggybo1 has joined #ocaml
jlouis_ has joined #ocaml
piggybox has quit [Connection timed out]
jlouis has quit [Read error: 110 (Connection timed out)]
buluca has quit [Read error: 104 (Connection reset by peer)]
piggybox has joined #ocaml
Jeff_123 has joined #ocaml
piggybo1 has quit [Read error: 110 (Connection timed out)]
dbueno has quit ["This computer has gone to sleep"]
Jeff_123 has left #ocaml []
qpu has quit []
crathman_ has joined #ocaml
crathman has quit [Connection reset by peer]
crathman_ is now known as crathman
seafood_ has joined #ocaml
cygnus_ has quit [Read error: 110 (Connection timed out)]
mordaunt has joined #ocaml
Snark has joined #ocaml
Jeff_123 has joined #ocaml
<wy> hey. anybody active?
<Jeff_123> context - you here?
<Jeff_123> sure, I'm here
<Jeff_123> wy? (yuk yuk)
<wy> Hi Jeff
<Jeff_123> hi
<wy> It seems that the channel is full of people come and people go messages ;-)
<Jeff_123> yup pretty much :(
<wy> I'm learning OCaml right now. Are you using it?
<Jeff_123> yup
<Jeff_123> how's it going?
<wy> Good. I'm just a little confused about the mutable polymorphic function type in records
<Jeff_123> do you mean something like,
<Jeff_123> type 'a something = { mutable thing : ('a -> 'a)};;
<Jeff_123> ?
<wy> Yes. Something like type idref = { mutable id: 'a. 'a -> 'a };;
<Jeff_123> oh hm, I haveven't seen that syntax before
<Jeff_123> the 'a. part I mean
<flux> wy, what is the problem?
<wy> I've never seen this before yet. I guess it means lambda a
<wy> No problem. I'm just trying to figure out the rule, because the tutorial is not specifying it.
<flux> so the problem isn't mutability, but the rest of the type of the field?
<wy> Does this mean that whenever the function inside a record is polymorphic, we need to specify the type of it. That's all? Are there other restrictions?
<flux> I think that's the only one
<Jeff_123> oh hm
<wy> Oh, it seems that the function in it must be exactly this polymorphic type in order to make it work
<wy> type idref = { id: 'a. 'a -> 'a };;
<wy> let r = {id = fun x -> x + 1};;
<flux> yes
<wy> gives an error that "This field value has type int -> int which is less general than 'a. 'a -> 'a"
<flux> you cannot call that function with value "foo" for example
<Jeff_123> huh, that's not a type definition I've ever noticed. Good to know it exists I guess.
<wy> So another rule is in the instancing of it.
<flux> I've found use to that with for example: { with_x: 'a. (x_handle -> 'a) -> 'a }
<flux> well it's a generic rule in ocaml that types must match :)
<wy> But it seems int->int matches 'a->'a.
<wy> Just a little more specific
<flux> actually no
<flux> module M : sig val foo : 'a -> 'a end = struct let foo a = a + 1 end;;
<Jeff_123> yup that won't work
<Jeff_123> it's cause signatures can't make a function or module any more general than it is
<Jeff_123> so like, (fun x -> x+1) : 'a -> 'a doesn't work, which is what you're trying to do with {id = fun x -> x + 1}
<wy> I haven't got to the part about modules yet
<wy> Have you tried F#? I wonder if it can be put to production use now
<Jeff_123> it's the same idea; signatures can restrict types but not generalize
olleolleolle has joined #ocaml
<Jeff_123> that's probably a question for the f# mailing list. I haven't had a use for it.
olleolleolle has left #ocaml []
asmanur has joined #ocaml
ygrek has joined #ocaml
seafood_ has quit []
buluca has joined #ocaml
bluestorm_ has joined #ocaml
<Jeff_123> howdy
<bluestorm_> hi
ttamttam has joined #ocaml
olleolleolle has joined #ocaml
olleolleolle has left #ocaml []
marmottine has joined #ocaml
bluestorm_ has quit [Remote closed the connection]
crathman has quit ["ChatZilla 0.9.79 [Firefox 2.0.0.11/2007112718]"]
Anarchos has joined #ocaml
<Anarchos> Did anybody have problems with the makefiles of ocaml 3.10.0 ?
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
Jeff_123 has quit [Read error: 104 (Connection reset by peer)]
wy has quit ["Ex-Chat"]
<context> is it possible to do double linked list with records instead of tuples, im having the hardest time trying to get it to work
<context> get type mismatches iwth 'a 'b 'c all the time :(
<flux> type 'a dlist = { value : 'a; mutable prev : 'a dlist; mutable next : 'a dlist }
<context> two seconds
<context> are there any paste sites that do ocaml
<pango> context: cycles and immutable datastructures don't mix well? :)
<pango> http://pastebin.be/, among others
<context> i get 'a list , 'b list error
<context> o.
<context> err yeah im still confused
<context> if my code just sucks please tell me :)
<pango> root is a list_node, up is a list_tree... you probably want up = Node root
<flux> context, what is the type of parameter root in your opinion?
<context> yeah cyclical type's suck
filp has joined #ocaml
<context> flux: it 'is' a list_tree, but its a Node, which makes it a list_node :/
<flux> ok, so if it's a list_node, it cannot be put to the up-field, which is of type list_tree
<context> Node root still dies
<context> flux: i realize that, but i cant go list_node = Empty | Node as { blah }
<context> err of
<flux> you just need to name the intermediate types, just as you have done
<context> so how do i go about 'convincing' it that root is of list_node :/
<flux> but it's not?
<pango> same problem line 11, mixing the two types again
<flux> maybe the "basic element" you want to handle here is list_tree, not list_node
<flux> how to do list_node = Empty | Node of { blah }? type list_node = Empty | Node of list_node' and list_node' = { blah }
<flux> (mostly what you've done already)
<pango> context: you can annotable a value with (value:type); while usually not necessary (thanks to type inference) it can help while debugging typing problems
seafood_ has joined #ocaml
<context> how does the ' on list_node' effect it :/
<flux> it's just a name
<context> :/
<flux> ' is a valid character in ocaml labels
<context> kk
<context> flux: so your telling me to do what i already am doing ? :x
<flux> I'm telling you the data type is correct :)
<flux> isn't the tree supposed to be either empty or a node?
<flux> so root should be of type 'a list_tree?
<context> ahh
<context> but root IS a list_tree
<flux> oh, but you want the whole thing be mutable
<flux> that brings a new level of indirection..
<context> or i need to like tell it root is list_tree before the match root.down
<pango> context: if root is a 'a list_tree, it conflicts with root.down expression, that implies it's a 'a list_node
<context> grrr !!!
<context> root.down is a list_tree though not list_node
<context> oh
<context> its implying root is a list_node then
<flux> the thing that makes this a bit more complicated is that you want the root of the tree to be mutable also, so you need to wrap it inside ref
<context> so this is just a lost cause ?
<flux> I hope you won't feel like I'm spoiling it for you (although someone surely will): http://rafb.net/p/peZl0f55.html
* context bashes head into wall
<flux> so I changed the basic node to be a ref type
<flux> this removes the need of the other mutable fields, because they always refer to that mutable type
<context> ahh
<flux> and what you were missing was that you needed to use pattern matching to access the node-field of root
<flux> ..which is only possible if it is infact a Node
Morphous is now known as Amorphous
<flux> I'm not sure if the code itself makes sense though :)
<flux> but perhaps this will help you forward..
<context> <3
<context> flux: yes. thnx
<context> that makes sense
<context> err oops
<flux> list_create won't quite work in that setup; why not return ref Empty there?
<context> thats what i was about to do
<flux> heh, ocaml toplevel is quite useless in displaying that data structure
<flux> so perhaps adding iter, map, foldl and foldr will be useful next
hkBst has joined #ocaml
<flux> btw, something I've liked when writing double-linked lists in c++ has been that the ends of the list are tied together, so you can traverse the list in reverse or forward just as fast; also appending an element to either end of the list becomes quite fast
<context> grrr ! i think i should give up for the night :/ this is just bothering me now
<context> this linked list is the roach motel, values go in but i cant take them out
<context> i have to write a method to get values out of it :/
<qwr> flux: if you don't want to add to the start, then array is probably faster
<pango> could be convenient to have some 'cursor' type to visit lists
<context> im reading developing with ocaml, and double linked list was an excersise, but i dont like he idea of using tuples
<flux> undoubtedly you will find use for tuples too at some point
<context> flux: yeah im sure ocaml optimizes usage of it out, but adding to a double linked list would mean re-writing the ENTIRE list
<context> which just sounds wierd coming from a C standpoint
zmdkrbou_ has joined #ocaml
<pango> maybe the point of the exercice was to make you realize that
<pango> that, as I pointed out, they're problems mixing cycles and immutability
<flux> context, you could use tuples with ref-type fields too
<flux> context, note that you're not doing that much better, iterating the whole list through to add one element :)
<context> hmm, records just seem better since you can directly access them :/
* context has much to learn
<context> flux: :p
<pango> (and the reason why standard lists are single chained)
zmdkrbou1 has joined #ocaml
<context> thnx all :)
zmdkrbou has quit [Read error: 113 (No route to host)]
smimou has joined #ocaml
zmdkrbou_ has quit [Read error: 113 (No route to host)]
Tetsuo has joined #ocaml
bluestorm_ has joined #ocaml
montoya has joined #ocaml
<context> camlp4 almost looks like a headache
<bluestorm_> you mean, the syntax ?
<bluestorm_> you'll get used to it rather quickly
<context> all together
<bluestorm_> hm
<bluestorm_> i think it's quite powerful too
<context> do you really have to do stuff 1 char at a time or am i looking at really bad examples
<bluestorm_> hm
<bluestorm_> what are you trying to do ?
<context> parse a string into seperate peices
<context> regexp is easy, but i see camlp4 in code a lot more then Str.
<bluestorm_> hm
<bluestorm_> given an arbitrary language, it's extremely unlikely that regexpes can parse it
<bluestorm_> so if you're lucky enough to have a regexp-parsable language, go ahead, use Str
<bluestorm_> (or any other regexp library out there)
<jcpiza> is there MT19937 for ocaml?
<bluestorm_> what's MT19937 ?
<jcpiza> a twister mersenne pseudorandom generator
<bluestorm_> is it difficult to code yourself ?
<bluestorm_> hm
<bluestorm_> you can look for libraries at the Hump : http://caml.inria.fr//cgi-bin/hump.en.cgi
seafood_ has quit []
<jcpiza> thanks, i will look for.
<bluestorm_> are looking for MT19937 specifically ?
<bluestorm_> i know of serveral RNG in OCaml (in the standard lib, in Xavier Leroy's Cryptokit), but don't know the algorith they use
buluca has quit [Read error: 113 (No route to host)]
<context> kk time for bed. thnx all
Yoric[DT] has joined #ocaml
<Yoric[DT]> hi
suppaman_ has joined #ocaml
suppaman_ has quit [Client Quit]
Tetsuo has quit [Remote closed the connection]
zmdkrbou1 is now known as zmdkrbou
Anarchos has joined #ocaml
<Anarchos> hello
Tetsuo has joined #ocaml
<Anarchos> i can't install ocaml, i have some strange errors in the 'unix' folder
<Yoric[DT]> You can try and ask on the mailing-list.
<Yoric[DT]> Xavier Leroy is known to read it.
<Anarchos> Yoric[DT] wow i don't want to disturb such an ocaml guru just about a makefile not running on an exotic system ;)
<Yoric[DT]> :)
<Anarchos> it is because of this notion of shared Makefiles in the 'otherlibs' folder
<bluestorm_> hum
<bluestorm_> does ocamlbuild still use the makefiles ?
<bluestorm_> i thought it was ocaml-only
<bluestorm_> (and i though 3.10 uses ocamlbuild, but maybe i'm wrong there too)
<Yoric[DT]> No, ocamlbuild doesn't use Makefiles.
<bluestorm_> +t
Smerdyakov has quit [Remote closed the connection]
<jcpiza> hi
<jcpiza> is ocaml thread-safe?
<bluestorm_> what does it mean for a *language* do be thread-safe ?
<bluestorm_> you can run multiple caml processes at the same time
<bluestorm_> and there is a multi-threading library
<jcpiza> is the ocaml platform thread-safe?
<bluestorm_> (although threaded code doens't execute simultaneously)
<bluestorm_> jcpiza: mostly
<bluestorm_> some libraries manage an inner state
<bluestorm_> and thus aren't
<bluestorm_> in the standard lib, only Str isn't thread-safe
<jcpiza> can i run 2 or more thread in a ocaml program?
<jcpiza> thanks, ok.
<Anarchos> Yoric[DT] i mean for the compilation of ocaml itself
<Anarchos> jcpiza ocaml runtime and threading is a very difficult sensitive subject
<jcpiza> then, is it better compiled as non-threaded?
<Anarchos> jcpiza i don't understand your options, sorry
<bluestorm_> Anarchos: what version are you compiling ?
<bluestorm_> i thought the 3.10 could use ocamlbuild instead of makefiles
<bluestorm_> hm
ttamttam has left #ocaml []
<bluestorm_> you're gonna say that as ocamlbuild use ocaml, you have to build ocaml before using ocamlbuild :-'
<Anarchos> bluestorm_ right :) and theree is a new Makefile.shared at the root of 'otherlibs' which was not there in the former versions
<pango> ocaml compilers are written in ocaml, so no matter what it needs bootstrapping
<Anarchos> pango not right : try to install an ocaml distro and you will need ' make' ;)
Smerdyakov has joined #ocaml
<pango> Anarchos: I don't get your point
deneb has joined #ocaml
<Anarchos> pango you need 'make' to recompile ocaml
<pango> never said otherwise
love-pingoo has joined #ocaml
<pango> the INSTALL file describes the two ways to compile OCaml, including the new ("experimental") one using ocamlbuild
<Anarchos> ops i didn't see it, i will read it again
<pango> Another alternative, is to use the experimental build system that use
<pango> ocamlbuild instead of make (it replaces steps 2 to 5):
<pango> ./build/fastworld.sh
<Anarchos> there is no mention of this alternative experimental build in my INSTALL file
pango_ has joined #ocaml
pango has quit [Nick collision from services.]
pango_ is now known as pango
<Anarchos> pango> there is no mention of this alternative experimental build in my INSTALL file
<pango> it's in http://caml.inria.fr/pub/distrib/ocaml-3.10/ocaml-3.10.0.tar.bz2 for sure, I just downloaded it
<Anarchos> let me update my cvs then ;)
<Anarchos> ah ok i got it
<Anarchos> it is great if it works !!
<pango> BeOS is not in the list of officially supported platforms, so both could be just as well broken
ita has joined #ocaml
pattern has quit [Read error: 110 (Connection timed out)]
pattern has joined #ocaml
buluca has joined #ocaml
wy has joined #ocaml
kelaouchi has quit [Remote closed the connection]
dbueno has joined #ocaml
qpu has joined #ocaml
<Anarchos> pango i know. Now it stops just on a 'Printf.sprintf' not found
Associat0r has joined #ocaml
dbueno has quit ["This computer has gone to sleep"]
Anarchos has quit ["Vision[0.8.5-0418]: i've been blurred!"]
charlesg3 has joined #ocaml
wy has quit ["Ex-Chat"]
<charlesg3> Howdy fellow caml'rs -- I'm getting this error when trying to compile my first ocaml program: "Unbound module GMain", I have the liblablgtk2-ocaml-dev package installed
<Smerdyakov> Is there a standard linking FAQ page that we should be directing questions like this to? :D
<mbishop> You need to tell the compiler where to find lablgtk2, try 'ocamlopt -I +lablgtk2 lablgtk.cmxa gtkInit.cmxa ...'
<Smerdyakov> charlesg3, have you looked for a README in the library? Usually, every library author assumes no one understands linking and gives example command lines.
<charlesg3> Smerdyakov: I'll look for it
<charlesg3> mbishop: thanks, that seems to have gotten me past that error
<mbishop> You should also look for ocamlfind, helps with all the weird flags for linking
<charlesg3> is gtk the most popular ui toolkit? will it be cross platform?
<bluestorm_> charlesg3: it will be cross platform
<bluestorm_> gtk is probably the most popular ocaml ui toolkit
<bluestorm_> (because it's mostly the only one)
<mbishop> There is tk as well...but yeah :)
bluestorm_ has quit [Remote closed the connection]
love-pingoo has quit ["Connection reset by pear"]
charlesg3 has quit ["Lost terminal"]
pchiusano has joined #ocaml
<pchiusano> hello
jlouis has joined #ocaml
Smerdyakov has quit ["Leaving"]
Smerdyakov has joined #ocaml
<pchiusano> hi, I am an ocaml newbie, and have a question
qpu has quit []
<pchiusano> if I define a type like type 'a list = Nil | Cons of 'a * ('a list);;
<pchiusano> and I have a value like l = Cons(1, Nil)
<pchiusano> is there a way to destructively update the 'tail' field of l?
<pchiusano> or do I need to say l2 = Cons(1, newtail)
<pango> no
<Smerdyakov> You should try to avoid mutation as much as possible.
<Smerdyakov> If there is really some compelling reason to want it, then we can talk about that, but, if you are new to OCaml, you are probably wrong if you want to mutate a list.
<pchiusano> hehe, okay
<pchiusano> I am just asking if it is possible, not if it is idiomatic ocaml
<pchiusano> :)
<pchiusano> btw, I am coming from a haskell background
<Smerdyakov> Goodness gracious, then why do you want to mutate a list? :D
<pchiusano> hehe
<pchiusano> so, it is strictly impossible then?
<Smerdyakov> It's impossible with the type definition you gave, which is alpha-equivalent to the standard [list] definition.
<pchiusano> mm hmm
<pchiusano> but there is some other type definition for which it would be possible?
<Smerdyakov> Sure.
<Smerdyakov> type 'a list = Nil | Cons of 'a ref * 'a list ref
<pchiusano> what is ref?
<Smerdyakov> (Note that the double semicolons are very rarely needed, and so you should try to avoid including them in code examples on IRC. ;-)
<pchiusano> hehe, okay
<Smerdyakov> pchiusano, do you know where the core library reference is? It's defined there.
jlouis_ has quit [Read error: 110 (Connection timed out)]
<Smerdyakov> Yup, but you need to browse one page deeper.
<pchiusano> the Pervasives?
<Smerdyakov> Yes
<pchiusano> aha, I see now
<pchiusano> with your definition of list, using refs, can I still pattern match as before?
<Smerdyakov> You can still pattern match, but you have to use different syntax.
<pchiusano> or will my patterns look like tail (Cons(_,ref(t)) = t
<Smerdyakov> That's how they'd look in SML.
<Smerdyakov> refs are primitive in SML. In OCaml, they're defined upon mutable records, so you use record pattern syntax.
<pchiusano> okay...
<pchiusano> sorry, I am not really familiar w/ that syntax... I should probably go read up on basic syntax stuff on my own :)
<pchiusano> thanks for the help
* pchiusano is trying to figure out descriptions
<Smerdyakov> What's a description?
<pchiusano> how do you get messages to show up with a * in front?
<pchiusano> you know like: * pchiusano goes back to reading
asmanur has quit [Remote closed the connection]
<Smerdyakov> Oh. Time for another of my patented logician hair-splitting answers.
asmanur has joined #ocaml
<pchiusano> ?
<Smerdyakov> The only completely formal answer is in terms of the IRC protocol, since IRC clients are free to provide whatever interfaces they want.
<pchiusano> I see people do it all the time in irc, but I never actually figured it out...
<pchiusano> what are you supposed to put for the first param
<pchiusano> ohh
<Smerdyakov> The answer you're not looking for is: send "PRIVMSG:, followed by the channel named, followed by ASCII character 1, followed by ":ACTION", followed by the text, followed by ASCII character 1. (Or something like that)
<Smerdyakov> The answer you are looking for is almost certainly: /me does something.
* pchiusano oat bag time for meee
* pchiusano is impressed with Smerdyakov's highly accurate responses
<Smerdyakov> My sarcasm detector is unreliable. Perhaps you could annotate your last line with intent? :_)
<pchiusano> I was not being sarcastic :)
<Smerdyakov> Me and everyone's uncle wrote IRC bots Back In The Day.
<pchiusano> is there an ocaml bot here?
<pchiusano> > 1 + 1
<pchiusano> on #haskell, if you do > expr, it will get evaluated and the bot shows the result
<flux> if there were, it would have nick "xavierbot", and you respond to lines that have ;; in it
<flux> but as you can see, it's not around now..
<pchiusano> 1 + 1;;
<pchiusano> hm
buluca has quit [Read error: 113 (No route to host)]
<pchiusano> can you have multiple parameter variant types?
<Smerdyakov> Sure. You just gave an example with your custom list type.
<pchiusano> like is type 'a 'b pair = Pair of 'a * 'b
<pchiusano> ..valid?
<pchiusano> er, what is syntax for that
<Smerdyakov> Almost.
<pango> type ('a, 'b) pair = Pair of 'a * 'b
<Smerdyakov> Please, read the tutorial in the manual. :-)
<pchiusano> hehe, okay, I will do that before asking more silly questions
<pchiusano> okay, I am taking off, thanks for help, all
* pchiusano is looking forward to learning more ocaml
pchiusano has quit ["Leaving"]
olleolleolle has joined #ocaml
montoya has quit [Remote closed the connection]
olleolleolle has quit [Client Quit]
jlouis_ has joined #ocaml
asmanur has quit [Remote closed the connection]
ita has quit ["Hasta luego!"]
jlouis has quit [Read error: 110 (Connection timed out)]
olleolleolle has joined #ocaml
qpu has joined #ocaml
ertai has joined #ocaml
hkBst has quit ["Konversation terminated!"]
Tetsuo has quit ["Leaving"]
Snark has quit ["Quitte"]
filp has quit ["Bye"]
marmottine has quit [Remote closed the connection]
ertai has quit [Read error: 110 (Connection timed out)]
olleolleolle has left #ocaml []
seafood_ has joined #ocaml
ertai has joined #ocaml
ygrek has quit [Remote closed the connection]
deneb has quit ["KVIrc 3.2.4 Anomalies http://www.kvirc.net/"]
ertai has quit [Read error: 110 (Connection timed out)]
jhome is now known as jeom
Demitar has quit [calvino.freenode.net irc.freenode.net]
Demitar has joined #ocaml
qpu has quit []
wy has joined #ocaml