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!)
hjs` has joined #ocaml
<jdavis_> how is (=) defined when operating on two sets? I think the sets are identical, yet it returns false.
mordaunt has quit [Remote closed the connection]
<bluestorm> jdavis_: i think (=) on sets is supposed to be sane
<bluestorm> try YourSet.compare
<jdavis_> bluestorm: hmm... I am actually printing out the sets, and they appear equal to me. I will have to investigate more I suppose, perhaps I am making a simple mistake.
<bluestorm> if it return 0, the two sets are identical
<bluestorm> hm
<bluestorm> YourSet.equal exist too
<bluestorm> +s
<jdavis_> Ok
<bluestorm> in case of inequality, YourSet.diff may be useful (set difference)
<jdavis_> Ah, of course. That's a quick way to tell
<jdavis_> hmm... not equal, and yet diff appears to be empty (both a-b and b-a).
<bluestorm> hm
<bluestorm> your printing function may disfunction
<bluestorm> you could try to eval your code in the toplevel
<bluestorm> and use the pretty-printing to see the contents of Yourset.elements (Yourset.diff ...)
<jdavis_> Yeah, I'll certainly have to investigate in more detail, but my print function is pretty simple, it's just FDSet.iter print_endline fd
<bluestorm> try FDSet.iter (Printf.printf "[%s]\n")
<bluestorm> (flushing issues maybe ?)
<jdavis_> how do I pretty print?
<bluestorm> where ?
<jdavis_> The list returned by FDSet.elements
<bluestorm> FDSet.iter (Printf.printf "[%s]\n%!")
<bluestorm> jdavis_: hm, the simple way is to get the list in the toplevel
<jdavis_> Ok, I'll just do that.
<jdavis_> My sets aren't exactly strings.
<jdavis_> I'm changing it to FDSet.iter (printf "foo!\n") fdset
<jdavis_> same thing... if there are any elements, it'll print "foo!\n" for each one.
<jdavis_> wait, equal and compare both work right! it's (=) that returns false.
jlouis has joined #ocaml
<jdavis_> so (=) doesn't equal equal.
<bluestorm> hm
<bluestorm> you can't control (=) effect on baroque types
<jdavis_> what's a baroque type?
<bluestorm> but i think it's guaranteed that you won't get false positives
<bluestorm> hm
<bluestorm> Set seems strange enough
<jdavis_> and what does (=) really do? is it bitwise equality?
<bluestorm> isn't
<bluestorm> (=) is a generic "structural equality"
<bluestorm> jdavis_: for example
<bluestorm> imagine Set is implemented with balanced binary trees
<bluestorm> you have one set s1, slightly unbalanced
<bluestorm> and one set s2, wich is s1 after balancing
<bluestorm> (=) could return false
<bluestorm> because from some point of view, they're not equal
<bluestorm> even if they hold exactly the same elements
<jdavis_> Ok, I see. I will have to remember to use .equal for logical equality.
<bluestorm> (i don't know if it is the exact thing happening here, i have no idea of Set implementation, but you get the idea)
<bluestorm> what you call "bitwise equality"
<jdavis_> It seems like a bad idea for = to not mean equal (but still work), if you ask me.
<bluestorm> may be "physicial equality", wich is (==)
<bluestorm> jdavis_: (=) mean equal for some point of view
<bluestorm> wich is the stricter point of view available after physical equality, i guess
<bluestorm> you're considering an equivalence relation on sets, "have the same elements"
<jdavis_> but it's sets we're dealing with, so = should mean "set equality" just like .equal.
thermoplyae has quit [Remote closed the connection]
<bluestorm> the meaning you put into your implementation doesn't change (=)
<jdavis_> bluestorm: that's not equivalence, it's equality of values. A set is a value, and it is the exact same value if it has the same elements.
<bluestorm> imagine i create a type 'a list = Nil | Cons of 'a list * 'a list
<bluestorm> give it hd (leftest element in the tree), and tl and the like
thermoplyae has joined #ocaml
<bluestorm> and i give it to you in a module List
<bluestorm> should (=) guess that it has to mean "have the same elements" ?
<jdavis_> Ah, I see what you're saying.
<jdavis_> basically, (=) is ocaml built-in, and doesn't know what a set is.
<bluestorm> yes
<bluestorm> his behaviour is Set-implementation dependent
<jdavis_> ok
<jdavis_> thanks for clarifying that.
<bluestorm> if you want to fine-tune equality, you provide a function "equal" in your module
<jdavis_> My program is actually working now, by the way, which is the first useful thing I've written in ocaml. There's still a lot to be done, but this is a very interesting hobby project.
<bluestorm> what is it ?
<jdavis_> It's designed to manipulate functional dependencies (related to database normalization)
<jdavis_> It can compute the closure of a set of attributes, or determine if two separate sets of FDs are equivalent.
<bluestorm> (i'm personally delighted to code little useless things : less responsabilities)
<jdavis_> me too :)
<jdavis_> I'm gonna hook this thing up to postgresql so that it can infer the functional dependencies from the keys in the database.
jlouis__ has quit [Connection timed out]
<jdavis_> Thanks for the help (and thanks to everyone else in here too). It feels good to actually accomplish something that I might use, and I learned a lot about ocaml.
yminsky has joined #ocaml
jnkm has quit ["ku u i te"]
Mr_Awesome has joined #ocaml
Associat0r has quit []
thermoplyae has quit ["daddy's in space"]
yminsky has quit []
bluestorm has quit ["Konversation terminated!"]
jonafan has joined #ocaml
jonathanv has quit [Read error: 110 (Connection timed out)]
buluca has joined #ocaml
jonathanv has joined #ocaml
jonafan has quit [Read error: 110 (Connection timed out)]
asmanur has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
bluestorm has joined #ocaml
robyonrails has joined #ocaml
rillig has joined #ocaml
leo037 has joined #ocaml
Morphous has joined #ocaml
Associat0r has joined #ocaml
leo037 has quit [Read error: 113 (No route to host)]
Amorphous has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
robyonrails has quit ["Leaving"]
jlouis_ has joined #ocaml
ertai has quit [calvino.freenode.net irc.freenode.net]
zmdkrbou has quit [calvino.freenode.net irc.freenode.net]
kreaturr_ has quit [calvino.freenode.net irc.freenode.net]
acatout has quit [calvino.freenode.net irc.freenode.net]
tsuyoshi has quit [calvino.freenode.net irc.freenode.net]
Sparkles has quit [calvino.freenode.net irc.freenode.net]
mattam has quit [calvino.freenode.net irc.freenode.net]
pants3 has quit [calvino.freenode.net irc.freenode.net]
mrsolo has quit [calvino.freenode.net irc.freenode.net]
richardw has quit [calvino.freenode.net irc.freenode.net]
junis has quit [calvino.freenode.net irc.freenode.net]
bebui_ has quit [calvino.freenode.net irc.freenode.net]
bluestorm has quit [calvino.freenode.net irc.freenode.net]
jonathanv has quit [calvino.freenode.net irc.freenode.net]
Smerdyakov has quit [calvino.freenode.net irc.freenode.net]
kmeyer has quit [calvino.freenode.net irc.freenode.net]
hjs` has quit [calvino.freenode.net irc.freenode.net]
kelaouch1 has quit [calvino.freenode.net irc.freenode.net]
jeremiah has quit [calvino.freenode.net irc.freenode.net]
jdavis_ has quit [calvino.freenode.net irc.freenode.net]
DerDracle_ has quit [calvino.freenode.net irc.freenode.net]
unfo- has quit [calvino.freenode.net irc.freenode.net]
orbitz has quit [calvino.freenode.net irc.freenode.net]
pattern has quit [calvino.freenode.net irc.freenode.net]
malodios has quit [calvino.freenode.net irc.freenode.net]
rillig has quit [calvino.freenode.net irc.freenode.net]
Mr_Awesome has quit [calvino.freenode.net irc.freenode.net]
Chile` has quit [calvino.freenode.net irc.freenode.net]
huh has quit [calvino.freenode.net irc.freenode.net]
cmeme has quit [calvino.freenode.net irc.freenode.net]
eroyf has quit [calvino.freenode.net irc.freenode.net]
jlouis_ has quit [calvino.freenode.net irc.freenode.net]
ygrek has quit [calvino.freenode.net irc.freenode.net]
jlouis has quit [calvino.freenode.net irc.freenode.net]
pango has quit [calvino.freenode.net irc.freenode.net]
jedai has quit [calvino.freenode.net irc.freenode.net]
jhome has quit [calvino.freenode.net irc.freenode.net]
hcarty has quit [calvino.freenode.net irc.freenode.net]
TaXules has quit [calvino.freenode.net irc.freenode.net]
petchema has quit [calvino.freenode.net irc.freenode.net]
svenl has quit [calvino.freenode.net irc.freenode.net]
|Jedai| has joined #ocaml
jlouis_ has joined #ocaml
ygrek has joined #ocaml
rillig has joined #ocaml
bluestorm has joined #ocaml
jonathanv has joined #ocaml
Mr_Awesome has joined #ocaml
jlouis has joined #ocaml
hjs` has joined #ocaml
Chile` has joined #ocaml
Smerdyakov has joined #ocaml
huh has joined #ocaml
ertai has joined #ocaml
pango has joined #ocaml
zmdkrbou has joined #ocaml
pants3 has joined #ocaml
kmeyer has joined #ocaml
mrsolo has joined #ocaml
jedai has joined #ocaml
kelaouch1 has joined #ocaml
jeremiah has joined #ocaml
jhome has joined #ocaml
richardw has joined #ocaml
junis has joined #ocaml
kreaturr_ has joined #ocaml
acatout has joined #ocaml
tsuyoshi has joined #ocaml
DerDracle_ has joined #ocaml
mattam has joined #ocaml
TaXules has joined #ocaml
cmeme has joined #ocaml
bebui_ has joined #ocaml
orbitz has joined #ocaml
petchema has joined #ocaml
pattern has joined #ocaml
Sparkles has joined #ocaml
unfo- has joined #ocaml
jdavis_ has joined #ocaml
eroyf has joined #ocaml
svenl has joined #ocaml
hcarty has joined #ocaml
malodios has joined #ocaml
eroyf has quit [SendQ exceeded]
eroyf has joined #ocaml
jlouis has quit [Connection timed out]
Mr_Awesome has quit ["aunt jemima is the devil!"]
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
Morphous has quit ["shutdown"]
jedai has quit [Connection timed out]
Amorphous has joined #ocaml
robyonrails has joined #ocaml
jnkm has joined #ocaml
robyonrails has quit ["Leaving"]
rillig has quit [Read error: 110 (Connection timed out)]
buluca has joined #ocaml
jlouis_ has quit [Remote closed the connection]
jlouis has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
buluca has joined #ocaml
pango has quit [Remote closed the connection]
pango has joined #ocaml
buluca has quit [Read error: 113 (No route to host)]
zmdkrbou has quit [Read error: 110 (Connection timed out)]
<hcarty> s
<jonathanv> d
<hcarty> I could not agree more
<bluestorm> hm
<bluestorm> i've been reading an article about smart bright new viruses, trojans and storm
<bluestorm> and then i thought "OCaml : increase your virus-writing productivity !"
<bluestorm> may be the lack of sleep
<bluestorm> but i'm functional languages could actually do wonders for such kind of applications
<bluestorm> +sure
<bluestorm> (it may seems a bit funnier than the usual "write a metamathematical framework", but still i'm not sure it would do so well for an advertising plan)
jonathanv is now known as jonafan
buluca has joined #ocaml
asmanur has quit [Connection timed out]
|Jedai| is now known as jedai
buluca has quit [Read error: 113 (No route to host)]
asmanur has joined #ocaml
jedai has quit ["KVIrc 3.2.6 Anomalies http://www.kvirc.net/"]
zmdkrbou has joined #ocaml
ygrek has quit [Remote closed the connection]
ygrek has joined #ocaml
bluestorm has quit ["Konversation terminated!"]
jlouis_ has joined #ocaml
jlouis has quit [Connection timed out]
|Catch22| has joined #ocaml
mrsolo has quit [Read error: 104 (Connection reset by peer)]
jlouis has joined #ocaml
jlouis_ has quit [Read error: 110 (Connection timed out)]
ygrek has quit [Remote closed the connection]
jlouis_ has joined #ocaml
jlouis has quit [Read error: 110 (Connection timed out)]
Yoric[DT] has joined #ocaml
<flux> happy new year. well, it came already an hour ago here in finland ;).
<Yoric[DT]> Happy New Year :)
Yoric[DT] has quit ["Ex-Chat"]
bluestorm has joined #ocaml