flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab OCaml 3.10.2 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
bluestorm has quit [Remote closed the connection]
vbmithr_ has joined #ocaml
vbmithr has quit [Read error: 104 (Connection reset by peer)]
hkBst has quit ["Konversation terminated!"]
Axioplase has joined #ocaml
seafood has joined #ocaml
delamarche has joined #ocaml
delamarche has quit [Client Quit]
delamarche has joined #ocaml
Morphous_ has joined #ocaml
jlouis has quit [Remote closed the connection]
netx303 has joined #ocaml
r0bby has quit [Success]
Morphous has quit [Read error: 110 (Connection timed out)]
r0bby has joined #ocaml
Ched- has quit [Read error: 110 (Connection timed out)]
Ched- has joined #ocaml
ramenboy has quit [Remote closed the connection]
seafood has quit []
sponge45 has quit ["see you at http://ocamlhackers.ning.com/"]
Kopophex has quit ["Leaving"]
pango_ has quit [Remote closed the connection]
pango_ has joined #ocaml
seafood has joined #ocaml
Jeff_123 has quit [Read error: 104 (Connection reset by peer)]
tsuyoshi has quit ["Lost terminal"]
tsuyoshi has joined #ocaml
Jeff_123 has joined #ocaml
netx has quit ["Leaving"]
Axioplas1 has joined #ocaml
Axioplase has quit [Read error: 110 (Connection timed out)]
Axioplas1 has quit ["brb"]
Axioplase has joined #ocaml
mdzy has joined #ocaml
mdzy has quit []
Snrrrub has joined #ocaml
filp has joined #ocaml
mishok13 has joined #ocaml
netx303 has left #ocaml []
Snark has joined #ocaml
bluestorm has joined #ocaml
Axioplase has quit ["Lost terminal"]
asmanur has joined #ocaml
hkBst has joined #ocaml
guillem has joined #ocaml
munga has joined #ocaml
tomh has joined #ocaml
gildor has quit ["leaving"]
Yoric[DT] has joined #ocaml
Demitar has joined #ocaml
guillem has quit [Remote closed the connection]
OChameau has joined #ocaml
jlouis has joined #ocaml
jlouis has quit [Remote closed the connection]
jlouis has joined #ocaml
delamarche has quit []
delamarche has joined #ocaml
delamarche has quit [Client Quit]
gildor has joined #ocaml
Associat0r has quit []
sponge45 has joined #ocaml
letrec has quit ["ChatZilla 0.9.83 [Firefox 3.0/2008052906]"]
Jedai has joined #ocaml
bluestorm has quit [Remote closed the connection]
wlmttobks has joined #ocaml
marmotine has joined #ocaml
RobertFischer has joined #ocaml
RobertFischer has left #ocaml []
Linktim has joined #ocaml
seafood has quit [Connection reset by peer]
seafood has joined #ocaml
RF_Smokejumper has joined #ocaml
sporkmonger has quit []
pango_ has quit [Remote closed the connection]
RobertFischer has joined #ocaml
pango_ has joined #ocaml
Linktim has quit ["Quitte"]
RF_Smokejumper has quit [Read error: 110 (Connection timed out)]
RobertFischer has left #ocaml []
sporkmonger has joined #ocaml
peck has joined #ocaml
<jonafan> i got my parser working!
<jonafan> however i still do not do let binding
<jonafan> but it is first and foremost an educational project, and i consider myself much more educated
<flux> vixey, the problem is that if any value can be a lazy value, all values need to be boxed - unless you have some smart compiler stuff going on
<vixey> flux: like type inference? :p
<flux> vixey, vixey, it would be more like whole-program-compilation
<flux> whops
<vixey> jonafan: cool let is usually defined in terms of lambda (let ((name value) ...) body ...) ~> ((lambda (name ...) body ...) value ...)
<vixey> flux: oh .. what is that ?
<vixey> what is that?*
<flux> vixey, you take the whole program and perform optimizations on that, instead of small parts of it at a time
<flux> see mlton :)
<vixey> mm
<vixey> oh I understand
<jonafan> yeah i was thinking i would translate a let expression into a function application
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
filp has quit ["Bye"]
<vixey> hmm
<vixey> jonafan: you now what ocaml is strict and has side effects
<vixey> jonafan: How are you interpreting the scheme code?
<flux> btw, laziness and side effects don't mix either, it can be a nightmare to debug code where a + b causes some other code to be executed (versus !!a + !!b)
<jonafan> i am using ocamllex and ocamlyacc to translate to my ocaml variant type
<vixey> I don't know what that variant type is
<vixey> are you going to put all your code online?
<asmanur> hm... it's not possible to read a printf-format from a non-litteral string ?
<jonafan> let expr = Int of int | None | If of expr * expr * expr | Fun of string list * expr | Application of expr * expr list | etc ...
<vixey> yeah jonafan
<vixey> You could probably use HOAS and get a faster interpreter than rewriting directly
<jonafan> i think it's actually kind of wrong because i also have like Plus of expr * expr as an expression, but scheme doesn't do it like that
<jonafan> HOAS?
<vixey> instead of Fun of string * expr, you can have Fun of (expr -> expr)
<jonafan> oh yeah perhaps
<vixey> I tried it out before it's super aocool
<vixey> at least it makes things run much faster
<vixey> if you are interested in it this is a good example
mishok13 has quit [Read error: 131 (Connection reset by peer)]
<jonafan> the example i'm learning from actually compiles ml
<vixey> are you writing a compiler
<jonafan> well, it doesn't ACTUALLY compile, it just kind of has it's own instruction lists that it converts to
<jonafan> like bytecode i guess
<vixey> on the pl zoo?
<jonafan> yeah
<vixey> I've seen that
<vixey> that is definitely called compiling
<jonafan> do you think that sort of thing is a good idea here?
<vixey> I think you should check the HOAS thing I linked
<vixey> it's so neat
<jonafan> my tests seem to indicate that doing that is much less efficient if you're going to run inside ocaml
<jonafan> however, i also adapted that to output assembly code, which was cool
<jonafan> (very inefficient assembly code)
<Jeff_123> Whats a good source for learning to write compilers? I've always wanted to know how, and I know some MIPS assembly.
vbmithr has joined #ocaml
<vixey> I don't know any assembly
<jonafan> it's constantly popping stuff on the stack, only to immediately pop them off and use them
<jonafan> er pushing stuff on the stack
<vixey> Jeff_123: I like this book Compiling with continations by Appel, and Marc Feeleys thing about compiling scheme in 90 mins is worth looking at
vbmithr_ has quit [Read error: 104 (Connection reset by peer)]
<vixey> jonafan: is that the sort of thing a peephole optimizer fixes?
<jonafan> i have no idea
<Jeff_123> thinks vixey, I'll look into it
<jonafan> i scanned of the wikipedia article
<jonafan> i don't think it would help much here
<Jeff_123> Oh sweet it's written in an ML language
<jonafan> well, maybe
ChristopheT has joined #ocaml
ChristopheT has left #ocaml []
bluestorm has joined #ocaml
Axioplase_ is now known as Axioplase
marmotine has quit ["mv marmotine Laurie"]
redocdam has joined #ocaml
munga has quit [Read error: 110 (Connection timed out)]
_andre has joined #ocaml
<_andre> i have this function that returns an array of keys from a hash
<_andre> let keys h = let keys = Hashtbl.fold (fun k _ ks -> k :: ks) h [] in Array.of_list keys
<_andre> can anyone think of a way to do that without creating the intermediate list?
<_andre> (and keeping the function polymorphic :)
Linktim has joined #ocaml
<flux> I see a way, but it's full of evil and I would never do it :). constructing an array of the proper length default-initialized by using Obj.magic, and then replacing the elements one by one with Hashtbl.iter
<_andre> let me know it so i.. uhm.. won't use it :P
<flux> call/cc could fit in here, although I doubt it would be any better performing soltuion
<flux> so you have a performance problem related to doing that?
<_andre> nah, it's just curiosity
<bluestorm> _andre: you could use a 'a option array, and then map it to an 'a array after filling
<flux> would that work with unboxed types?
<bluestorm> hm ?
<flux> or did you mean plain Array.map
<bluestorm> yes
<_andre> but that would still require walking over the data twice, no?
<flux> nevertheles, it could still be faster
<bluestorm> that would require manual unboxing and handling the error case
<bluestorm> (wich won't happen)
<bluestorm> hm
<bluestorm> another solution would be have an 'a array ref
<bluestorm> initialized at ref []
<bluestorm> then you iter, and on the first element you change it to a array of the correct length
<bluestorm> this should be quite fast and is typesafe
<bluestorm> haha mfp
<mfp> could remove the ugly thing to get a random key by using Obj.magic (also ugh)
<bluestorm> that one is evil
<flux> whoa
<flux> :)
<mfp> plus
<mfp> it's not guaranteed to be faster than lists
<flux> but it's nicer than the using Obj.magic
<mfp> esp. if the array is allocated in the major heap
<mfp> because of caml_modify
Kopophex has joined #ocaml
<flux> the thing is that that solution still walks over the region twice: once to initialize, second time to fill in
<mfp> it's probably faster up to 256 words or so (IIRC the limit for blocks in the minor heap)
<mfp> yeah
<flux> I wonder how Array.init does it
<mfp> I don't see any way to avoid the double assignment here
<flux> but one can't really compose a function with Hashtbl and Array.init
<flux> (without continuations or threads)
<mfp> probably inits to 0 (like Obj.magic 0, or in C)
<flux> I suppose it must. but it will likely be fast, although Array.make would not likely be much (or any) slower
<bluestorm> flux: hm
<flux> walking a list can still be quite slow compared to walking an awway
<flux> array :)
<bluestorm> it's not a two-walk way as the first walk is promptly interrupted
<flux> bluestorm, I meant the destination
<bluestorm> ah
<bluestorm> Array.init is two-walk too
<mfp> it *must* be, you cannot run OCaml code with an uninitialized block around
<flux> apparently Array.init uses a similarish approach
<flux> as in: let init l f = if l = 0 then [||] else let res = create l (f 0) in for i = 1 to pred l do unsafe_set res i (f i) done; res
<flux> so doing that youself should not be slower in any case
<flux> (except you're unlikely to use unsafe_set without much self-confidence)
<mfp> I sometimes wish the runtime didn't use a list for the remembered set
marmotine has joined #ocaml
<mfp> (well, a resizable array to be precise)
<flux> the remembered set?
<mfp> the references to values in the minor heap from blocks in the major heap
TypedLambda has joined #ocaml
<mfp> hmm I wonder if things like Array.copy would benefit from some manual loop unrolling
<mfp> flux: the problem being that updating the same reference repeatedly results in the pointer being added many times to the remembered set
<mfp> so you have to realloc the buffer, etc.
<mfp> if it used a card marking sys for instance, that'd be no problem, and caml_modify could be faster
<mfp> traversing the remembered set would be: faster if there have been many updates to the same reference, slower if the updates are spread throughout the major heap (?)
OChameau has quit ["Leaving"]
ofaurax has joined #ocaml
LordMetroid has joined #ocaml
asmanur has quit [Remote closed the connection]
netx has joined #ocaml
philip has joined #ocaml
sporkmonger_ has joined #ocaml
sporkmonger has quit [Read error: 104 (Connection reset by peer)]
filp has joined #ocaml
mishok13 has joined #ocaml
netx has quit ["This computer has gone to sleep"]
netx has joined #ocaml
tomh has joined #ocaml
Axioplase is now known as Axioplase_
Snark has quit ["Ex-Chat"]
Associat0r has joined #ocaml
Snrrrub_ has joined #ocaml
Snrrrub_ has quit [Read error: 104 (Connection reset by peer)]
Linktim has quit ["Quitte"]
Jedai has quit ["KVIrc 3.2.4 Anomalies http://www.kvirc.net/"]
sporkmonger_ has quit [Read error: 60 (Operation timed out)]
bohanlon has joined #ocaml
_andre has quit ["leaving"]
filp has quit ["Bye"]
mishok13 has quit [Read error: 60 (Operation timed out)]
bluestorm has quit ["Leaving"]
philip has quit [Read error: 110 (Connection timed out)]
hkBst has quit ["Konversation terminated!"]
sporkmonger has joined #ocaml
delamarche has joined #ocaml
netx has left #ocaml []
Snrrrub has quit [Read error: 104 (Connection reset by peer)]
tomh has quit ["http://www.mibbit.com ajax IRC Client"]
marmotine has quit ["mv marmotine Laurie"]
Yoric[DT] has quit ["Ex-Chat"]
coucou747 has joined #ocaml
sporkmonger has quit []
rwmjones has quit ["Closed connection"]
peck has left #ocaml []
netx has joined #ocaml