gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
<wmeyer> ssbr: I am thinking about Datalog
<ssbr> wmeyer: what are your thoughts?
<orbitz> It's thinking about you
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 248 seconds]
ulfdoz_ is now known as ulfdoz
milosn has joined #ocaml
milosn_ has quit [Ping timeout: 265 seconds]
mjonsson has joined #ocaml
milosn_ has joined #ocaml
milosn has quit [Ping timeout: 265 seconds]
milosn_ has quit [Ping timeout: 244 seconds]
milosn has joined #ocaml
milosn_ has joined #ocaml
milosn has quit [Ping timeout: 245 seconds]
<wmeyer> ssbr: I think it's the right thing to do - currently reading some papers
<wmeyer> I meant including it a compiler framework for various purposes
<ssbr> wmeyer: ah, you write compilers?
<wmeyer> some of the stuff not pushed
<wmeyer> (in particular the backends will be generated)
<wmeyer> would you be able to point out some good literature about Datalog and it's applications in the compiler domain?
fraggle_ has joined #ocaml
<ssbr> wmeyer: I'm sorry, I wouldn't know.
<ssbr> wmeyer: the only paper I read was the bddbddb paper
fraggle_ has quit [Remote host closed the connection]
<ssbr> I never even finished it :p
<wmeyer> ah yes, it's already on my dish
<ssbr> wmeyer: well, good luck then
sepp2k has quit [Remote host closed the connection]
<wmeyer> ssbr: I'm thinking about bootstraping simple interpreter
<ssbr> right now, the only thing I can say is that I think datalog implementations should be strongly typed with HM-style type inference.
<wmeyer> or even a camlp4 compiler
<wmeyer> that's interesting!
<ssbr> well I can say lots of things, but this is the one that sticks out right now (because I'm dealing with the fallout of not doing that)
<ssbr> (our datalog implementation is weakly-statically typed, somewhat C-style)
<ssbr> (also there's no separate typing phase, which is unclear and bothersome)
<wmeyer> but doesn't make the system more similar to theorem provers especially talking here about Twelf
<ssbr> wmeyer: I don't understand what you mean
<wmeyer> adding types to Datalog
<ssbr> wmeyer: any BDD-based datalog implementation must be statically typed, because you need to know the size of the domains in order to encode them into the BDD data structure
<ssbr> the size of the domains -- the range of possible values for each tuple component in a relation
<ssbr> but I don't understand what comparison you're drawing to Twelf, anyway
<ssbr> (I actually can't read the sentence, derp, sorry. :<)
<wmeyer> so does BDD contain inductive types (aka. ADTs)
<ssbr> wmeyer: BDDs don't have anything other than bits, by default
<ssbr> wmeyer: some BDD implementations may introduce APIs that permit abstraction -- for example, the (old, unmaintained) BuDDy contains a system for letting you talk about integers of some fixed width, rather than just bits -- you can group bits together to form these integers.
<ssbr> In the same way, you could group these bits together to form ADTs, but they'd have the space usage properties of C union types.
<ssbr> also if they're recursive, that goes against the spirit of Datalog in that it allows for unbounded recursion
<ssbr> ... aside from not being even representable this way, of course. Heh, silly me.
<wmeyer> you can always use peano arithemtic -- that's how it's normally done
<ssbr> wmeyer: every datatype is bounded in BDD-based datalog
<ssbr> this is a necessary consequence of the evaluation strategy -- all the relations are defined as binary relations of fixed arity
fraggle_ has joined #ocaml
<ssbr> BDDs don't work with nonfixed arity, nor do they work with nonbinary relations
<ssbr> hummmmm, "binary relation" probably has the wrong implications, huh? I mean a relation of tuples of bits
emmanuelux has quit [Remote host closed the connection]
mjonsson has quit [Remote host closed the connection]
milosn_ has quit [Ping timeout: 244 seconds]
milosn has joined #ocaml
tac-tics has joined #ocaml
<ssbr> wmeyer: I'm writing type inference :/ :/
<ssbr> worse, I'm not doing it based on HM, because jesus everything on the internet everywhere is inscrutable
<ssbr> I'm just unifying types and assuming that's close enough to how HM works
<ssbr> (I can totally do unification)
<ssbr> anyway, it turns out that constant expressions like "{1,2,4}" can't really be done the way the code is laid out, because it's impossible to find out what type it is locally like that. You need to go one level higher, and it's a mess, and I wanted to have a real type detection system anyway
<ssbr> Plus type inference on stuff like "foo in bar" can't be done either, which is a massive drag -- "in" isn't statically typed, so you _need_ to infer types, except the tools aren't there.
<ssbr> Hum. Is it not possible to raise an arbitrary exception with a string?
<ssbr> there's invalid_arg and failwith that do that, but raise doesn't
<_habnabit> ssbr, exceptions don't necessarily take a string
<_habnabit> ssbr, raise takes an instance of an exception; failwith is implemented as, essentially: let failwith s = raise (Failure s)
<ssbr> _habnabit: ohhhh, I see.
<ssbr> Sorry, I am apparently incapable of discovering how exceptions work without asking stupid questions
milosn has quit [Ping timeout: 245 seconds]
struktured has joined #ocaml
Kakadu has joined #ocaml
wagle is now known as wagle_
wagle_ is now known as wagle
edwin has joined #ocaml
blinky- has joined #ocaml
eni has joined #ocaml
eni has quit [Ping timeout: 244 seconds]
milosn has joined #ocaml
Snark has joined #ocaml
osa1 has joined #ocaml
fschwidom has joined #ocaml
osa1 has quit [Ping timeout: 246 seconds]
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
Tobu has quit [Remote host closed the connection]
Tobu has joined #ocaml
mcstar has joined #ocaml
<mcstar> hi
<mcstar> im sad
<mcstar> ocaml is segfaulting on me
<mrvn> do you use Obj.*?
<mcstar> no, this is a very simple immutable code
<mrvn> stack overflow?
<mcstar> was before
<mcstar> but when i increase the stack size i get segfault
<mcstar> it is an algorithm to generate all the permutations of a list
<mrvn> probably still overflowing. Rewrite some code to be tail recursive
<mcstar> i think it is
<mcstar> i did it in haskell
<mcstar> it is faster than the built in one
<mcstar> and i specifically rewrote it to be tail recursive
<mcstar> the original wasnt
<mcstar> ill paste the code
edwin has left #ocaml []
<mcstar> for comparison, for 9, the haskell one is 3 times faster
<mcstar> and ofc i dont get stack overflow with that one
<mcstar> mrvn: can you confirm the tail recursivity?
<mrvn> Lots of non tail recursive functions in there
<mcstar> well, the go in perm is tail recursive
<mcstar> the other go in extend is not
<mcstar> i can try to rewrite that
<mrvn> concat, map, @
<mcstar> i dont want to rewrite the built in ones
<mrvn> you don't want to use them
<mcstar> then whats the point of having them?
<mrvn> For when you don't have such huge lists
<mrvn> Still not totaly tail recursive. But the recusion depth is equal to the length of input. And since the resulting list is O(n!) long you will run out of memory long before that becomes a problem.
_icke_ has quit [Quit: leaving]
<mcstar> well
<mcstar> it definitely runs
<mcstar> but quite slow
<mcstar> for 11 it takes 48 secs vs 5 of my haskell one
<mcstar> for 10, 4.5s vs. 0.55s
<mcstar> 4.3 vs. 4.5
<mcstar> your last one vs. the previous
<mcstar> and 48 vs. 48 for inout 11
<mcstar> this is the haskell one for reference
<mrvn> tail recursive isn't always faster
<mcstar> mrvn: anyway thanks for the rewrite
<mrvn> Should be faster than yours but doesn't preserve the order.
<mrvn> still nowhere near the 5s haskell takes
<mcstar> mrvn: emacs?
<mrvn> yes
<mrvn> With 1-11 my system starts to swap.
<mcstar> i have 6g
<mcstar> i didnt pay attention to memory usage
<mrvn> I have 4
<mcstar> so i would guess that lazyness pays off in this case
<mrvn> You are creating a 5G big list just to count its length.
<mcstar> yeah, thats the point
eni has joined #ocaml
<mrvn> How fast is your ocaml version?
<mcstar> the haskell one runs in 0.1% memory
<mcstar> i.e. low constant space
<mcstar> mrvn: the original?
<mrvn> mcstar: Mine uses far less memory than yours by the way since it shares the tail of the lists.
<mrvn> mcstar: yes
eni has quit [Client Quit]
eni has joined #ocaml
<mcstar> for input 9
<mcstar> 0.7s
<mcstar> yours takes 0.42
<mcstar> but this is your second paste
<mcstar> ill try your lates
<mcstar> t
<mrvn> That will be the reduced memory use mostly.
<mrvn> mcstar: My last paste is just yours made a bit more tail recursive.
<mcstar> 0.75
<mcstar> well its a bit slower
<mcstar> but it can handle bigger inputs, thats good
<mrvn> odd. List.rev_map should be faster and my concat too.
<mcstar> at least it doesnt segfault
<mcstar> oops
<mcstar> i started swapping
<mcstar> i dont want to flame
<mcstar> but im quite pleased with the haskell one
<mrvn> hashkell must be optimizing the list completly away and just count.
<mcstar> well, probably
<mcstar> since it doesnt consume memory
<mcstar> what about ocaml lazy lists?
<mrvn> But what is the point of that? In ocaml I just write "fac 11" and am still faster than your haskell code.
<mcstar> the point is to understand how to generate permutations
<mcstar> and you might want them in real code
<mcstar> (and yes i know, thats different than counting them)
<mrvn> sure. But then you don't just List.length them.
<mrvn> And if you want to handle size 11+ lists you probably want to write an enumeration that outputs them one at a time instead of computing the full list ahead of time.
<mrvn> Just to safe some memory.
<mcstar> thats what i wanted to ask
<mcstar> ocaml has lazy lists
<mcstar> i guess enumerations are something different
<mrvn> Well, it has Lazy. You can build lists with that
<mcstar> is it like a yield in python?
<mrvn> enumeration is just what Batteries calls an iterator.
emmanuelux has joined #ocaml
Anarchos has joined #ocaml
Yoric has joined #ocaml
Kakadu has joined #ocaml
sgnb has quit [Read error: Connection reset by peer]
sgnb has joined #ocaml
Yoric has quit [Ping timeout: 264 seconds]
Yoric has joined #ocaml
osa1 has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
osa1 has quit [Client Quit]
Framedragger has joined #ocaml
TaXules has quit [Ping timeout: 244 seconds]
TaXules has joined #ocaml
osa1 has joined #ocaml
sepp2k has joined #ocaml
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
osa1 has quit [Quit: Konversation terminated!]
eni has quit [Ping timeout: 246 seconds]
Kakadu has quit [Ping timeout: 252 seconds]
Kakadu has joined #ocaml
eni has joined #ocaml
Submarine has quit [Ping timeout: 248 seconds]
Yoric has quit [Ping timeout: 264 seconds]
loxs has joined #ocaml
milosn has quit [Ping timeout: 244 seconds]
milosn has joined #ocaml
pangoafk is now known as pango
lin has joined #ocaml
pango is now known as pangoafk
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 246 seconds]
ulfdoz_ is now known as ulfdoz
mjonsson has joined #ocaml
hongboz has joined #ocaml
fschwidom has quit [Remote host closed the connection]
hcarty has quit [Ping timeout: 248 seconds]
<hongboz> Hi, all, how do you get `a parsable type definitions' without touching the source three?
<hongboz> source tree. sorry
<hongboz> I know cmidump. but sometimes the .cmi contains so many definitions, is there any refined method?
chris_st has joined #ocaml
hcarty has joined #ocaml
<Kakadu> hongboz: I don't think that I understood you correctly but maybe you need sexplib?
<hongboz> kakadu: no. suppose I only have .cmo, .cmi files
<hongboz> I want get the type definitions in the modules
fraggle_ has quit [Remote host closed the connection]
<hongboz> It's doable, since the .cmi contains all the information you need, but I am not sure there exist an elegant way?
<hongboz> `type definitions' means the source level type definitions
<chris_st> hi -- having a hard time getting files to compile... please see this http://pastie.org/4098153
<Kakadu> hongboz: I also want to know answer for your question :)
<Kakadu> chris_st: You didn't forget 'open ...', did you?
<hongboz> Kakadu: I have 3 tricks, but none of them is perfect..
<hongboz> 1 is using ocaml -i
<hongboz> 2 is using cmidump making use of compiler-libs
<hongboz> 3 is using toplevel
<chris_st> Kakadu: Sorry, I'm *REALLY* a noob -- I tried adding 'open dog_type' after the 'open OUnit', and I get a syntax error.
<Kakadu> open Dog_type
<Kakadu> Modules start from capital letter
<Kakadu> hongboz: cmigrep?
<chris_st> Kakadu: But... but... it's not a module! It's a class! I'm so confused :-/ Do I have to put the class in a module to get it to compile separately?
<hongboz> Kakadu: no. it can not do that
<Kakadu> chris_st: class dog_type from them module Dog_type. Use 'open Dog_type;; new dog_type" or "new Dog_type.dog_type"
<chris_st> Kakadu: Thanks, I'll try that.
<hongboz> Kakadu: Thanks. I need an api interface. Maybe I should roll my own toploop...
pangoafk has quit [Quit: reboot, big update]
<chris_st> So, like I say, I'm a noob, working through Hickey's book. I've got http://pastie.org/4098212 defined, and it compiles on its own, but when I try to use it (either the "open Dog_type;; new dog_type" or "new Dog_type.dog_type") I get "Error: Unbound module Dog_type".
<Kakadu> filename is almost moduleName
<Kakadu> If you have module A in file b.ml you should open B.A
<chris_st> Kakadu: Same error... does the directory have to go in there somewhere? Would capitalizing the filename help?
<Kakadu> what files do you have?
<chris_st> src/dog_type.ml and test/dog_test.ml. I can pastie their contents if it will help.
<chris_st> I'm really hoping I can have source in different directories :-)
<Kakadu> yeah, paste it
pango has joined #ocaml
<Kakadu> Do you execute ocamlfind... manually or through ocamlbuild?
<chris_st> test/dog_test.ml is http://pastie.org/4098250 src/dog_type.ml is http://pastie.org/4098253 and here's my compile line:
<chris_st> ocamlfind ocamlc -package oUnit -o dtest -linkpkg src/dog_type.cmo test/dog_test.ml
<chris_st> OR:
<chris_st> ocamlfind ocamlc -package oUnit -o dtest -linkpkg src/dog_type.ml test/dog_test.ml
<chris_st> Both fail.
<Kakadu> chris_st: try to add -I src option
Yoric has joined #ocaml
<chris_st> Bingo! Thanks so much!
Framedragger has quit [Ping timeout: 244 seconds]
chris_st has quit [Quit: chris_st]
Qrntz_ has joined #ocaml
tac-tics_ has joined #ocaml
loxs has quit [Ping timeout: 265 seconds]
struktured has quit [Remote host closed the connection]
fraggle_ has joined #ocaml
blinky- has quit [Quit: /unquit]
emmanuelux has joined #ocaml
yezariaely has left #ocaml []
deafmacro has joined #ocaml
Yoric has quit [Ping timeout: 244 seconds]
Framedragger has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
lamawithonel has quit []
deafmacro has left #ocaml []
emmanuelux has quit [Remote host closed the connection]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
tac-tics_ has quit [Ping timeout: 245 seconds]
emmanuelux has joined #ocaml
emmanuelux has quit [Remote host closed the connection]
lin has quit [Quit: Leaving]
tactics_ has joined #ocaml
tac-tics has quit [Ping timeout: 246 seconds]
hcarty has quit [Ping timeout: 245 seconds]
hcarty has joined #ocaml
tac-tics has joined #ocaml
tactics_ has quit [Ping timeout: 260 seconds]
fraggle_ has joined #ocaml
mjonsson has quit [Remote host closed the connection]
tac-tics has quit [Client Quit]
tac-tics has joined #ocaml
mjonsson has joined #ocaml
sepp2k has quit [Ping timeout: 244 seconds]
eni has quit [Ping timeout: 252 seconds]
Submarine has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
ulfdoz has joined #ocaml
Kakadu has quit [Quit: Konversation terminated!]
Sablier has joined #ocaml
sepp2k has joined #ocaml
struktured has joined #ocaml
Framedragger has quit [Ping timeout: 252 seconds]
mjonsson has quit [Remote host closed the connection]
struktured has quit [Ping timeout: 244 seconds]
carm has joined #ocaml
carm has quit [Ping timeout: 248 seconds]
dwmw2_gone has quit [Quit: Coyote finally caught me]
Submarine has quit [Quit: Leaving]
dwmw2_gone has joined #ocaml
tac-tics has quit [Read error: Connection reset by peer]
tac-tics has joined #ocaml
Submarine has joined #ocaml
Submarine has quit [Changing host]
Submarine has joined #ocaml
hcarty has quit [Ping timeout: 245 seconds]
hcarty has joined #ocaml
mjonsson has joined #ocaml
osa1 has joined #ocaml
olasd is now known as matecopter
matecopter is now known as olasd
loxs has joined #ocaml
BiDOrD has joined #ocaml
BiDOrD_ has quit [Ping timeout: 245 seconds]
icke has joined #ocaml
Snark has quit [Quit: Quitte]
osa1 has quit [Quit: Konversation terminated!]
mjonsson has quit [Remote host closed the connection]
mjonsson has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 244 seconds]
fraggle_ has quit [Ping timeout: 246 seconds]
loxs has quit [Quit: Leaving]
Yoric has joined #ocaml
Yoric has quit [Client Quit]
eni has joined #ocaml
eni has quit [Read error: Connection reset by peer]
eni has joined #ocaml
mcstar has quit [Quit: mcstar]
emmanuelux has joined #ocaml
sepp2k1 has joined #ocaml
fraggle_ has joined #ocaml
sepp2k has quit [Ping timeout: 265 seconds]
Smerdyakov has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
Smerdyakov has joined #ocaml
fraggle_ has quit [Remote host closed the connection]
Smerdyakov has quit [Quit: Leaving]
cyphase has left #ocaml []
tactics_ has joined #ocaml
Anarchos has quit [Quit: dodo time]
tac-tics has quit [Ping timeout: 246 seconds]
NaCl is now known as SpanishInqusitr
Anarchos has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
Sablier has quit [Read error: Connection reset by peer]
tac-tics has joined #ocaml
tactics_ has quit [Ping timeout: 246 seconds]
tactics_ has joined #ocaml
tac-tics has quit [Ping timeout: 246 seconds]