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>
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
<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
<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>
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)]