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