gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.0+beta1 http://permalink.gmane.org/gmane.comp.lang.caml.inria/49168
sepp2k has quit [Read error: Connection reset by peer]
Amorphous has quit [Ping timeout: 248 seconds]
jakedouglas has quit [Quit: Leaving.]
valross has quit [Remote host closed the connection]
elehack has joined #ocaml
metasyntax has joined #ocaml
<elehack> thelema: I just pushed a commit redoing the Makefile change to default to ocamlfind's default and use the README-documented DESTDIR rather than PREFIX.
<elehack> (if the user specifies no installation target, ocamlfind's default is better than ocamlc -where IMO)
<elehack> but we didn't support the DESTDIR that we documented before, which was an error.
<thelema> elehack: no problem - I looked for how we did PREFIX-style installation dir before, but didn't findn it
<thelema> I'm all for making mistakes quickly and moving forward - exactly as you've done to fix what I committed.
<elehack> ok, good to know :)
<elehack> And now my PPA should have updated Batteries packages whenever they get through the build queue.
<thelema> for 3.11?
<thelema> should we put your PPA on the wiki?
<elehack> yes, it's built against 3.11.
<elehack> and the PPA is already on the Install page of the wiki.
<elehack> it gets Git snapshots on a somewhat irregular basis.
<elehack> (and has a few other goodies)
<thelema> oh, I didn't realize.
<elehack> np
* thelema moves it up to the top of the page
<elehack> the installing from packages section?
<thelema> yes
<elehack> that sounds like a good idea.
<elehack> people probably would prefer doing that in general.
<thelema> better...
<thelema> especially lazy people, who might not scroll past the 'install from source' section
<elehack> yeah
<elehack> hey, the Debian people have updated the batteries package :)
<elehack> I should checkout how they updated the debian/rules file and compare it with my changes sometime.
jakedouglas has joined #ocaml
|marius| has quit [Remote host closed the connection]
|marius| has joined #ocaml
|marius| has quit [Read error: Connection reset by peer]
elehack has quit [Quit: not a typewriter]
halfie has quit [Ping timeout: 264 seconds]
jakedouglas has quit [Quit: Leaving.]
kaustuv has joined #ocaml
<kaustuv> Signature substitution + recursive modules lets me do something that I've always wanted in OCaml: duplicate record field names in a recursive type: http://ocaml.pastebin.com/9sAxUcV3
<kaustuv> It's not 100% as pretty as it can be, but I can live with it.
<kaustuv> (I suppose there is no reason why signature substitution is strictly necessary in this pattern, and might even be a nuisance since none of the modules will ascribe to the unsubstituted signature...)
iratsu has quit [Ping timeout: 246 seconds]
|marius| has joined #ocaml
ygrek has joined #ocaml
alexyk has joined #ocaml
<alexyk> I'm inverting a nested Hashtbl with 3-levels, swapping, in each path (from,day,to,n), to and from: => (to,day,from,n). Simple nested iter takes oto long, while Haskell/Clojure equivalents run faster: http://paste.pocoo.org/show/238188/ -- better ways?
joewilliams is now known as joewilliams_away
iratsu has joined #ocaml
dskippy has joined #ocaml
<flux> alexyk, I have no other advice than: 1) play with the GC parameters 2) play with the initial size of the hash
<flux> profiling would tell if the steps might be helpful beforehand
<kaustuv> In your calls to H.find_default, aren't you always constructing the default value even if it's not needed?
<alexyk> flux: here's Haskell: invert1 g = M.unionsWith (M.unionWith M.union) $
<alexyk> [M.singleton c (M.singleton b (M.singleton a d))
<alexyk> | (a,m') <- M.toList g, (b,m'') <- M.toList m', (c,d) <- M.toList m'']
<alexyk> note the generator of tuples from unrolled hash and generating it back with unions
<alexyk> takes 100 seconds on a 5 million user hash, while OCaml takes 12 minutes
<flux> alexyk, that's a map, not a hash?
<flux> alexyk, it might take a lot time to hash big structures.. more than merely comparing.
<flux> alexyk, as always when faced with performance issues: profile :)
<alexyk> kaustuv: is the default always evaluated?
<alexyk> flux: well they have no mutable ones
<alexyk> I use OCaml's Hashtbl as a fast Map
<alexyk> for most cases mutable is faster, so this is weird
<alexyk> perhaps kaustuv's observation is slowing it down
<dskippy> flux: Why would it take a long time to hash big structures compared to comparing them?
<flux> dskippy, you might find in the first step that they differ
<dskippy> flux: Ah. I see.
<flux> dskippy, but hashing must go all the way, wdell, atleast to some predetermined limit
<flux> alexyk, afaik haskell has hash tables as well, but you need to be i
<flux> in the IO or ST monad
<kaustuv> alexyk: since OCaml is strict, f a b c will always evaluate a, b and c
<alexyk> kaustuv: ah ok, then I'll replace with find_option
<flux> alexyk, profiling native code is easy. compile with -g and after running use gprof on the binary
<flux> (reading the results is slightly more tricky at times, though)
<alexyk> kaustuv: thx! do you think exceptions will be faster than find_option?
<alexyk> flux: ok, but I'll change it first :)
<kaustuv> Yes because find_option is implemented using exceptions (and does 1 extra allocation)
<kaustuv> but I doubt your code will show a measurable difference between exceptions and find_option
<thelema> alexyk: I've replaced Hashtbl with Map and gained lots of speed - Hashtbl can have bad performance if hash is expensive
<kaustuv> In this case he is hashing strings and ints, so hash is about as fast as it gets
<thelema> *very* bad performance
<alexyk> kaustuv: correct, the keys are very simple types
<thelema> the ocaml string hash isn't that great, imnsho
<kaustuv> thelema: explain? how can you be slower than O(string length)?
<kaustuv> or do you mean that it is too collidy?
<alexyk> thelema: is Batteries Map same pain to instantiate as the old one?
<alexyk> I mean, can you play with substituting Hashtbl by Map easier?
<alexyk> kaustuv: ok, find_option finishes in 125 seconds vs original 12 minutes vs Haskell's 100 seconds, acceptable :)
|marius| has quit [Remote host closed the connection]
<alexyk> kaustuv: will now compare your's exceptional one :)
<kaustuv> thelema: looking at ocaml/byterun/hash.c, the string hash function is basically the sdbm hash function from here: http://www.cse.yorku.ca/~oz/hash.html
<kaustuv> Or wait, I lied. String hashing uses Combine_small(), not Combine(), so its hash constant is 19 not 65599. Hmm... You might be right
<thelema> kaustuv: my experience with ocaml's hashing is pretty poor.
<thelema> I had a Hashtbl of parsed regular expressions (simple, resursive variant type) hashed into a hashtbl with 10K buckets and I was only using <20 of the buckets
<thelema> (according to ocamlviz)
<thelema> alexyk: batteries map is easy to instantiate, but it's not mutable, so you'll have to make adjustments to replace hashtbl with it.
<thelema> batteries map is simple polymorphic type, like hashtbl
<alexyk> thelema: ok, cool
<alexyk> is it Xavier's old pMap?
|marius| has joined #ocaml
<kaustuv> thelema: If you are not averse to a little compiler hacking, change the Combine_small() on line 72 of byterun/hash.c to Combine() and see if you still have so many collisions
|marius| has quit [Read error: Connection reset by peer]
<thelema> alexyk: yes, with more functions
<thelema> kaustuv: not today. now I sleep. Maybe I'll play with that in the future.
<alexyk> ok
ygrek has quit [Ping timeout: 245 seconds]
Amorphous has joined #ocaml
alexyk has quit [Quit: alexyk]
ttamttam has joined #ocaml
Yoric has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
alexyk has joined #ocaml
alexyk has quit [Client Quit]
valross has joined #ocaml
boscop has quit [Ping timeout: 258 seconds]
boscop has joined #ocaml
Yoric has quit [Quit: Yoric]
ikaros has joined #ocaml
Samae has left #ocaml []
ikaros has quit [Quit: Leave the magic to Houdini]
ftrvxmtrx has joined #ocaml
ttamttam has left #ocaml []
kaustuv has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
avsm has quit [Quit: Leaving.]
Associat0r has joined #ocaml
iratsu has quit [Ping timeout: 245 seconds]
valross has quit [Quit: Ex-Chat]
iratsu has joined #ocaml
ygrek has joined #ocaml
verte has joined #ocaml
dskippy has quit [Quit: Leaving.]
sepp2k has joined #ocaml
marteo has joined #ocaml
_andre has joined #ocaml
Yoric has joined #ocaml
ttamttam has joined #ocaml
oriba has joined #ocaml
oriba has quit [Client Quit]
Anarchos has joined #ocaml
Yoric has quit [Ping timeout: 258 seconds]
Associat0r has quit [Quit: Associat0r]
ttamttam has quit [Quit: Leaving.]
avsm has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
ygrek has quit [Ping timeout: 245 seconds]
Nimblefinger has joined #ocaml
<Nimblefinger> im just starting out trying to get my head round functional programming, and hopefully this is the right place to come for some help - im struggling to work out why this bit of code doesn't work. It's meant to create a list of digits in a number: http://pastebin.com/sXhDqSda
ygrek has joined #ocaml
<Nimblefinger> I should say I'm manually inputting the length of the number for now, since I was trying to make it as simple as possible to work out why it isn't working - the error message highlights "(list (x mod 10**len) len-1)" and says it has type int but is here used with type int list
_unK has joined #ocaml
<orbitz> Nimblefinger: what doesn't work?
<gildor> Nimblefinger: len-1 -> (len - 1)
<gildor> BTW, you also have redefined **, I suppose
<Nimblefinger> yes I have, sorry i forgot to say that
<orbitz> oh yes durh
<Nimblefinger> ah
<Nimblefinger> thanks
<Nimblefinger> could you possibly explain why that was incorrect for me?
<gildor> Nimblefinger: application of list take precedence over application of operator -
<Nimblefinger> ahhh
<Nimblefinger> thanks a lot :)
<Nimblefinger> makes sense now
__gilles_ has quit [Remote host closed the connection]
<Nimblefinger> well I've got my function to work and generate me a list of the digits in a number, but I'm pretty sure I'm going to be doing it in a really inefficient/daft way - would someone be able to comment a little on how to make this slicker, or just how bad/good it actually is since I have no real idea? http://pastebin.com/9uFifTuQ
<Nimblefinger> I particularly am unsure about the length bit
<Nimblefinger> oh, ignore the fact its called sumDigits - I'm eventually using it to solve one of the problems at projecteuler.net
<gildor> Nimblefinger: humm, your method is very inefficient
<gildor> Nimblefinger: using log to decompose a number is not a good idea
<gildor> Nimblefinger: http://pastebin.com/E1K0rYuu
<Nimblefinger> I guessed it would be, but i thought it would be best to have a go at something that works before getting help
<Nimblefinger> thanks a lot, i'll have a look through that and think it through :)
th5 has joined #ocaml
eldragon has quit [Ping timeout: 265 seconds]
eldragon has joined #ocaml
joewilliams_away is now known as joewilliams
EliasAmaral has joined #ocaml
alexyk has joined #ocaml
jakedouglas has joined #ocaml
eldragon has quit [Read error: Connection reset by peer]
eldragon has joined #ocaml
kaustuv has joined #ocaml
th5 has quit [Quit: th5]
alexyk has quit [Ping timeout: 265 seconds]
sepp2k has quit [Quit: Leaving.]
ftrvxmtrx has quit [Quit: Leaving]
verte has quit [Quit: ~~~ Crash in JIT!]
Associat0r has joined #ocaml
ygrek has quit [Remote host closed the connection]
ygrek has joined #ocaml
rwmjones has quit [Quit: Terminated with extreme prejudice - dircproxy 1.2.0]
rwmjones has joined #ocaml
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 240 seconds]
EliasAmaral has quit [Ping timeout: 264 seconds]
EliasAmaral has joined #ocaml
ftrvxmtrx has joined #ocaml
Nimblefinger1 has joined #ocaml
kaustuv has quit [Ping timeout: 246 seconds]
Nimblefinger has quit [Ping timeout: 240 seconds]
ygrek has quit [Ping timeout: 245 seconds]
ygrek has joined #ocaml
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 264 seconds]
f[x] has quit [Ping timeout: 265 seconds]
|marius| has joined #ocaml
|marius| has quit [Remote host closed the connection]
|marius| has joined #ocaml
alexyk has joined #ocaml
<alexyk> how do you create a new Batteries' Map? let m = Map... what?
Anarchos has joined #ocaml
<mehdid> alexyk: let m = BatMap.Make(...)
<alexyk> how how do we use StringMap, IntMap?
<mehdid> let m = BatMap.StringMap
<alexyk> ok
Nimblefinger has joined #ocaml
Nimblefinger1 has quit [Ping timeout: 260 seconds]
ulfdoz_ has quit [Quit: Reconnecting]
ulfdoz has joined #ocaml
ftrvxmtrx has quit [Read error: Connection reset by peer]
ccasin has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
<flux> whaat?
<alexyk> flux: whaat?
<flux> let m = BatMap.StringMap?
<flux> module M = BatMap.StringMap
<flux> let foo = M.empty
<flux> let foo2 = M.add ("hello", 42) foo
<flux> etc
schmrkc has left #ocaml []
<alexyk> ah, empty
<alexyk> so no need to specify any sizes like with Hashtbl
<flux> correct
<flux> of course, you can reuse (sahdow) the same symbol as well, to give it some (misleading ;-)) imperative feel
<flux> I imagine use-wise it's pretty much the same as in Haskell
<flux> except Haskell might provide some monadic facilities for manipulating it, dunno..
<alexyk> flux: yeah, so I'll need to compare against Hashtbl. I didn't realize Map is now polymorphic in Batteries, much mor eusable.
<alexyk> mfp has a faster one, hope they'll make it into Batteries too
<flux> those hashtables aren't polymoprhic
animist has quit [Ping timeout: 264 seconds]
<flux> BatPMap is the polymorphic one
<flux> and you need to use an explicit creation function for it (BatPMap.create)
<alexyk> flux: how is it performance-wise vs IntMap/StringMap?
<flux> the only overhead should be one level of function calls more
<flux> iow not much
<flux> infact, maybe not even that
Nimblefinger1 has joined #ocaml
<flux> because now that I think of it, PMap cannot use the real Map underneath it, atleast not easily
<flux> so it probably just inlines/copies the implementation in itself
Nimblefinger has quit [Ping timeout: 245 seconds]
avsm has quit [Quit: Leaving.]
<mehdid> flux: Indeed!
* mehdid needs to sleep
ccasin has joined #ocaml
_andre has quit [Quit: *puff*]
metasyntax` has quit [Quit: Be seeing you.]
boscop_ has left #ocaml []
boscop has joined #ocaml
ccasin has quit [Quit: Leaving]
alexyk has quit [Quit: alexyk]
ttamttam has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
ttamttam has quit [Quit: Leaving.]
ygrek has quit [Ping timeout: 245 seconds]
Nimblefinger1 has quit [Ping timeout: 240 seconds]
Anarchos has joined #ocaml
Anarchos has quit [Client Quit]
EliasAmaral is now known as dark
thieusoai has quit [Quit: Leaving]
letrec has joined #ocaml
joewilliams is now known as joewilliams_away
|marius| has quit [Remote host closed the connection]
|marius| has joined #ocaml
byrongibson has joined #ocaml
avsm has joined #ocaml
Associat0r has quit [*.net *.split]
eldragon has quit [*.net *.split]
gildor has quit [*.net *.split]
rossberg has quit [*.net *.split]
alpounet has quit [*.net *.split]
msteele_ has quit [*.net *.split]