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