gl changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | happy new year, dudes.
b00t has joined #ocaml
johnnowak has joined #ocaml
johnnowak_ has joined #ocaml
johnnowak has quit [Read error: 110 (Connection timed out)]
smimou has quit ["bli"]
johnnowak_ has quit [Read error: 110 (Connection timed out)]
velco has quit ["I'm outta here ..."]
jlouis has quit [Read error: 145 (Connection timed out)]
jlouis has joined #ocaml
triple_ has joined #ocaml
Smerdyakov has quit ["Leaving"]
Smerdyakov has joined #ocaml
zak has joined #ocaml
m3ga has joined #ocaml
jeberle has joined #ocaml
m3ga has quit [Client Quit]
Smerdyakov has quit ["Leaving"]
jeberle has left #ocaml []
zeeeee has joined #ocaml
<zeeeee> anybody using vim? trying to figure out how to get indentation to work...
<zeeeee> ....or in emacs, for that matter (just installed tuareg; not indenting my type def correctly)
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
Amorphous has quit [Connection timed out]
Amorphous has joined #ocaml
Mr_Awesome has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
pstickne has quit [Read error: 104 (Connection reset by peer)]
pstickne has joined #ocaml
Amorphous has quit [Connection timed out]
Amorphous has joined #ocaml
Amorphous has quit [Success]
<zeeeee> is there no standard (or at least a popular) mutable set implementation? (i know i can use hashtables)
<Mr_Awesome> Set.t ref ;)
zak has quit [Read error: 110 (Connection timed out)]
<zeeeee> Mr_Awesome: but that only allows you to mutate the reference, not the set..
<Mr_Awesome> hence the ;)
<zeeeee> i.e., you're still copying the whole set
<zeeeee> oh.
<zeeeee> ;(
<Mr_Awesome> implement your own :)
<Mr_Awesome> to answer your question, i dont think so. i certainly dont know of any
<flux-> zeeeee, you're not really copying the whole set, only log(N) elements
<zeeeee> flux-: oh, since it's a tree structure
<zeeeee> (i'm guessing)
<zeeeee> ?
<flux-> yes. trees are the holy grail of functional data structures ;-)
<Mr_Awesome> when i ran into this problem i just used a Set.t ref
<Mr_Awesome> and it worked
zak has joined #ocaml
sponge45 has quit ["zzzzzzzzzz"]
magnus--_ has joined #ocaml
magnus-- has quit [Read error: 110 (Connection timed out)]
Submarine has quit [Read error: 113 (No route to host)]
Amorphous has joined #ocaml
Mr_Awesome has quit ["...and the Awesome level drops"]
_velco has joined #ocaml
_velco is now known as velco
Amorphous has quit [Connection timed out]
Amorphous has joined #ocaml
ikaros has quit ["Leaving"]
Amorphous has quit [Success]
triple_ has quit [Read error: 60 (Operation timed out)]
Amorphous has joined #ocaml
beschmi has quit [Read error: 104 (Connection reset by peer)]
beschmi has joined #ocaml
bluestorm has joined #ocaml
zak_ has joined #ocaml
jlouis has quit [Remote closed the connection]
ikaros has joined #ocaml
david_koontz has quit ["Leaving"]
zak has quit [Read error: 110 (Connection timed out)]
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
smimou has joined #ocaml
Amorphous has quit [Connection timed out]
Amorphous has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
jlouis has joined #ocaml
Amorphous has joined #ocaml
Submarine has joined #ocaml
cmeme has quit [Connection reset by peer]
cmeme has joined #ocaml
triple_ has joined #ocaml
Amorphous has quit [Connection timed out]
Amorphous has joined #ocaml
b00t has quit [Remote closed the connection]
Amorphous has quit [Read error: 60 (Operation timed out)]
Submarine_ has joined #ocaml
Submarine has quit [Nick collision from services.]
Submarine_ is now known as Submarine
Amorphous has joined #ocaml
slipstream-- has joined #ocaml
Submarine_ has joined #ocaml
triple_ has quit ["leaving"]
Submarine has quit [Nick collision from services.]
Submarine_ is now known as Submarine
swater has joined #ocaml
slipstream has quit [Read error: 110 (Connection timed out)]
ulfdoz has quit [zelazny.freenode.net irc.freenode.net]
ulfdoz has joined #ocaml
Amorphous has quit [Connection timed out]
Amorphous has joined #ocaml
Submarine_ has joined #ocaml
love-pingoo has joined #ocaml
zak_ has quit ["Leaving"]
Submarine has quit [Read error: 110 (Connection timed out)]
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
ikaros has quit ["Leaving"]
Amorphous has joined #ocaml
ikaros has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
Axioplase has joined #ocaml
<Axioplase> Hi
<Axioplase> Is it possible to assign an order to an algebraic type ?
<Axioplase> eg : I defined Bottom and Top, and I want my sorting fucntions to know that Bottom < Top
<pango> there's already an order, but it's implementation-dependant... I don't think it's documented, much less guaranteed to persist unchanged in later versions
<Axioplase> hum..
<Axioplase> then I'll have to write some nasty code to do that..
<pango> it's safer to define your own comparison function, and use that in sorting functions, and the like
<Axioplase> yes, that's what I meant
<pango> if you want a full order, writing a function to map algebraic values to integers first could be enough...
<pango> I often wish I could use algebraic types as array indexes, too
Submarine__ has joined #ocaml
<Axioplase> pango: That's what I did.. match Foo -> (1,Foo) (since I have some types with the same order, and I want to be able to retrieve them after sorting the zipped list)
Amorphous has quit [Connection timed out]
<pango> have you checked that the function for mapping to ints is so slow that this is necessary ?
<pango> match is said to be aggressively optimized
<pango> (btw, the closest thing in the manual about constructors order is in the chapter about interfacing with C: http://caml.inria.fr/pub/docs/manual-ocaml/manual032.html#htoc220)
<Axioplase> well, I don't really care about speed in the current project...
Submarine_ has quit [Read error: 110 (Connection timed out)]
<mellum> Is it possible to link bytecode-compiled files with C objects?
<pango> ocamlc -custom ?
<mellum> Yeah, that works. Thanks. The error message was not particularly helpful...
<pango> Axioplase: way of the lazy: put assert(Bottom < Top) after your type definition. That way, the day the implementation breaks that assumption, at least nothing wrong happens ;)
Submarine__ has quit [Read error: 110 (Connection timed out)]
<Axioplase> Well, in fact, my algebraic type is a *little* bit more complex (it's a 10 elements complete lattice)
Amorphous has joined #ocaml
<pango> current implementation orders independantly the constant and non-constant constructors of algebraic types so that type t = A | B | C => A < B < C
joshcryer has quit [Connection timed out]
<lmbdwr> for which reason the ocaml compiler would fail on the last (empty) line of the file ?
<lmbdwr> with a syntax error
<lmbdwr> how to get a more precise error msg ?
<pango> could be a lot of thing, a missing 'in' after a let, etc, etc
shawn has quit [Read error: 113 (No route to host)]
<pango> put ;; between top-level declarations; use an editor with robust indentation; make someone else read your code :)
Amorphous has quit [Connection timed out]
balrog-kun has joined #ocaml
<balrog-kun> hi there
jlouis has quit [Remote closed the connection]
<balrog-kun> i'm making a samll gui for something using "Graphics" and the default doesn't seem to want to scale using Graphics.set_text_size
<balrog-kun> does someone know a font name that scales well in X?
<balrog-kun> or is set_text_size not implemented?
<balrog-kun> (for X)
<balrog-kun> s/default/default font/
<pango> value caml_gr_set_text_size (value sz)
<pango> {
<pango> return Val_unit;
<pango> }
<pango> so I guess it's not implemented
<balrog-kun> i see :(
<balrog-kun> i could sitch to using SDL but i'm too lazy :p
joshcryer has joined #ocaml
jlouis has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
jlouis has quit ["Leaving"]
jlouis has joined #ocaml
pango_ has joined #ocaml
pango has quit [Nick collision from services.]
pango_ is now known as pango
balrog-kun has left #ocaml []
<lmbdwr> what is the correct syntax in ocaml to create a type of type Cons when cons is passed as a string to the input
<lmbdwr> Expr(constr, elist) -> Con(constr, List.map (eval env) elist)
<lmbdwr> doesnt work
<lmbdwr> (with Expr beeing a known constructor)
<lmbdwr> of string * expr list
<pango> Cons must be a constructor, and not a type
<pango> but I think this code is correct
stevan__ has joined #ocaml
stevan_ has quit [Read error: 110 (Connection timed out)]
sponge45 has joined #ocaml
whatthedeuce has joined #ocaml
<Axioplase> (his code is right, I've done the same project :D)
pango_ has joined #ocaml
pango has quit [Remote closed the connection]
pango_ is now known as pango
<lmbdwr> that suck
<pango> what's the error message ?
<lmbdwr> I have a big match that takes an expression has as to return a value
<lmbdwr> one of my branch gives an error like : This expression has type value but is here used with type AbstractSyntax.value_variable = strin
<lmbdwr> +g
<lmbdwr> my understanding of the error msg say that the return type of the match is AbstractSyntax.value_variable and not value
<lmbdwr> it would be easier on a pastebin
<pango> http://nopaste.tshw.de/ is my favorite atm, lightweight and has OCaml highlighting
<lmbdwr> The error happens on the line 59 (I lightened a little bit the source to be self-contained and as small as possible)
Smerdyakov has joined #ocaml
love-pingoo has quit ["Connection reset by pear"]
<pango> lmbdwr: what does the message error refer to, precisely, on line 59 ?
<pango> s/message error/error message/
<lmbdwr> pango, Con(constr, List.map (eval env) elist)
<pango> the whole thing ?
<lmbdwr> yep
<lmbdwr> chars 31 -> 69
<Axioplase> lmbdwr: be careful with error messages...
<Axioplase> it means that it failed in unifying two expressions
<lmbdwr> I know
<Axioplase> and gives the line of the exp that failed typing. That means you have a constraint somewhere else
<lmbdwr> but Con() is of type value and thats what I need
<Axioplase> check the code where you use that expression (or the one where it is in)...
<lmbdwr> line is 51, as I said
<lmbdwr> err 59
<Axioplase> (still the interpret ?)
<lmbdwr> yea ..
<pango> I think you should, at least temporarily, add some type annotations
<Axioplase> lmbdwr: did't you just forget to define some other values ?
<Axioplase> (line 14)
<Axioplase> I mean... if your program is "fun x -> x;;"
<Axioplase> what is your result ?
<Axioplase> you need to define some values for functions too
<Axioplase> maybe doing that will make another constraint error, but it should clear that error you have now
<Axioplase> (ie : you need a value for closures)
<pango> the only non recusive branches of eval call find_var, and eval_match... find_var, as defined, is polymorphic, and the definition of eval_match is not provided
<pango> I guess the latter returns the wrong type, but that's just a guess
<lmbdwr> eval_match calls back eval depending on a match
<pango> anyway, try adding type annotations to expr, so it will report where inferred type is not what you expect, not a place where the expect type is correct because inferred type is different ;)
<Axioplase> lmbdwr: remove the function cases of the match
<Axioplase> and try again
<Axioplase> then remove the match case, and try again
<Axioplase> and always check types
whatthedeuce has left #ocaml []
<lmbdwr> Axioplase, hum, removing RecFunc and Func from the match removed the error
<lmbdwr> its strange : those match recurse on eval .. how can this fail to type correctly ?
pants1 has joined #ocaml
<Axioplase> because it added *THE* constraint that fails to unify *later*
<Axioplase> it's _not_ strange, it's what I told you before
<pango> bind_var f f env ?
<Axioplase> pango: no
<Axioplase> He just didn't realize that functional values should be returned as a closure
<pango> f as both variable and value ?
* pango smells a rat
<Axioplase> and if you read his code, he tries to evaluate the body of the function, instead of returning the closure
<Axioplase> pango: something like that
<Axioplase> anyway, what he needs to do is define a value for closures, and return this value for EFUN and ERECFUN
<Axioplase> and pay me a cup of coffee next on monday :)
<lmbdwr> hum, indeed if I comment ERecFunc its not failing anymore
<lmbdwr> I will try to do like Axioplase says
<lmbdwr> define a value for closure and returns this
<Axioplase> </hint>
<Axioplase> <dinner>
pango has quit [Remote closed the connection]
pango has joined #ocaml
pants1 has quit [Remote closed the connection]
ikaros has quit ["Leaving"]
pango has quit ["Getting off stoned server - dircproxy 1.0.5"]
pango has joined #ocaml
pango has quit [Excess Flood]
pango has joined #ocaml
ikaros has joined #ocaml
whatsup103 has joined #ocaml
balrog-kun has joined #ocaml
<balrog-kun> are the elements of a list always constant (i.e. not mutable)? or is there some way to assign values to them?
<Smerdyakov> Always constant
<balrog-kun> ok, thanks
<jlouis> mutable bad, mmmkay?
johnnowak has joined #ocaml
<balrog-kun> :)
<balrog-kun> if i made a list of references instead, how would i change the reference in, say, the head of the list?
<Smerdyakov> balrog-kun, scary question which makes it sound like you are trying to learn OCaml without reading a tutorial all the way through..
<balrog-kun> hmm, ok, probably my design is bad
<balrog-kun> the thing is i have a graph and each node stores a list of edges connecting it with other nodes, now if i make a new edge i need to update the list of edges in both nodes, so i need something mutable
<jlouis> To learn the merits of functional programming, thou must shun the ref-cells, for they will haunt your program, buggify it beyond recognition and twist your mind into a twisty little maze of passages
<balrog-kun> my mind is all twisty little maze of passages already :(
<jlouis> purely functional graph structures are hard to make effective
<jlouis> so a couple of ref-cells may actually be in order
<Smerdyakov> balrog-kun, no, it's OK to have a list of refs, but not to know how to implement that is a sign that you don't understand OCaml fundamentals.
<balrog-kun> oh ok
<balrog-kun> well
<balrog-kun> Smerdyakov: i'm gonna read up
joshcryer has quit [Read error: 104 (Connection reset by peer)]