flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
vixey has quit [Client Quit]
love-pingoo has quit ["Connection reset by pear"]
jak3 has quit [Read error: 110 (Connection timed out)]
|jedai| has quit [Read error: 60 (Operation timed out)]
|jedai| has joined #ocaml
xah_lee_ has quit []
ChrisRoland has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
jeddhaberstro has joined #ocaml
AxleLonghorn1 has left #ocaml []
Stefan_vK has joined #ocaml
Stefan_vK1 has quit [Read error: 110 (Connection timed out)]
christian__ has joined #ocaml
ched has quit [Read error: 145 (Connection timed out)]
Associ8or has quit []
Associat0r has joined #ocaml
jonasb has quit [Remote closed the connection]
seafood has quit [Read error: 110 (Connection timed out)]
ched has joined #ocaml
christian_ has quit [Read error: 110 (Connection timed out)]
willb has joined #ocaml
ChrisRoland has left #ocaml []
xah_lee has joined #ocaml
seafood has joined #ocaml
seafood has quit []
ulfdoz has quit [Read error: 60 (Operation timed out)]
ulfdoz has joined #ocaml
vpalle has joined #ocaml
vpalle has quit [Read error: 110 (Connection timed out)]
sporkmonger has quit []
mfp has quit [Read error: 101 (Network is unreachable)]
<xah_lee> if i have let x = ref 3;;, how do i print it something like print_int?
seafood has joined #ocaml
jeddhaberstro has quit []
<thelema> xah_lee: yes -- [print_int !x]
<xah_lee> thelema: ah that's obvious. Thanks.
<thelema> ! dereferences
<xah_lee> what's the proper name for the 7 or so build in types. Simple types? Primitive Types?
<xah_lee> and types like tuple and list, ref, is Compound Type?
<thelema> no proper name, just types.
<thelema> maybe standard types.
<xah_lee> umm
<thelema> built-in "derived" types include array, record and tuple (all the same under the hood)
<thelema> maybe that's it... built-in types
<xah_lee> ic. Are the derived type actually has definition in ocaml somewhere? or were they compiled into the compiler?
<thelema> those are built into the compiler.
<xah_lee> k
<thelema> refs are not primitive, they're actually a record with a single mutable field: "contents"
<thelema> the definition of them is found in pervasives.ml
<xah_lee> ic
<thelema> lists are sorta-primitive. They're implemented in the compiler, but almost all the code to deal with them is written in ocaml.
<xah_lee> how do you pronounce homogenous? as home-mo-G-nius or her-mam-ge-nus?
<thelema> ho-modge-in-nus
mfp has joined #ocaml
whiterussian is now known as ozzloy
pierre- has joined #ocaml
mrvn has quit [Read error: 104 (Connection reset by peer)]
mrvn has joined #ocaml
<bluestorm> mrvn: do you remember last time debate about changing application/composition operators associativity ?
<bluestorm> i think i actually changed my mind, and i'd agree with setting |> <| associativity to our own liking
<bluestorm> (the reasons being : 1/ it's really hard to find satisfying operators with the correct associativity 2/ that is made easy by a camlp4-treatment instead of a infix-operator treatment, wich also enables for inlining, wich is a sensible advantage 3/ (&&) and (||) already have a special status somehow, and our application operators should probably set the evaluation order in stone too)
schmx has joined #ocaml
schme has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
Snark has joined #ocaml
rwmjones_ has joined #ocaml
_zack has joined #ocaml
seafood has quit []
<mrvn> bluestorm: yep
Associat0r has quit []
<bluestorm> mrvn: do you think adding |> <| as camlp4 extensions, documenting the non-standard behavior, would be reasonable and not too bad practice ?
<mrvn> As I said, create some new operators. :)
<bluestorm> you mean lexically illegal ones ?
<mrvn> <| |> might be confusing with [| |] though.
<bluestorm> the reason for using |> <| >> << is that F# choosed them
<flux> indeed <| |> could find use as a new kind of literal, such as associative tables
<flux> but then again, perhaps it's too much punctuation
<bluestorm> (and while i'm not too found of that F# thing, I think making the gap between F# and OCaml easier for attracted-by-MS-marketing beginners is a careful idea)
<flux> besides, [# #] would be more suitable IMO :)
<bluestorm> flux: i guess that could be said of any "directed" operator
<bluestorm> as soon as you want an idea of "direction" in your operator (here >), you can use it for two direction infix, or two enclosing brackets
<flux> I think I'll withdraw that point, as a list-like construct should prefer using [ and ] in some form, to be less confusing
<bluestorm> agreed
<bluestorm> (btw do you have something against non-symmetric syntax such as the [? .. | ... ] i used in pa_comprehension ?)
<flux> well, that's not a list of elements
<flux> so I think it can be different
<flux> I think of no other reason to be symmetric other than there are already [| |] and [< >]
rwmjones_ has quit [Read error: 113 (No route to host)]
<flux> bluestorm, bluestorm.info/camlp4/ should really give an index of the files ;)
<bluestorm> creating a website is so boring :-'
<flux> indeed
<flux> you could always have fun doing it, and employ ocsigen
<bluestorm> :]
<bluestorm> i actually doubt my cheap PHP hosting would support ocsigen
<flux> they might support cgi
<flux> which might work if you don't expect high traffic :)
_zack has quit ["Leaving."]
<bluestorm> it's strange, the F# manual define <... operators as being left-associative, while let (<|) f x = f x should obviously be right-associative
seafood has joined #ocaml
<mrvn> can you even chain <? a < b < c doesn't make much sense to me.
<mrvn> it wouldn't do what it looks like
<bluestorm> a < b < c doesn't type anyway
<bluestorm> but a <| b <| c could
jlouis has joined #ocaml
<mrvn> If I understood <| correctly that is the same as (c (b a)), right?
<bluestorm> hm
<bluestorm> no, rather (a b) c or a (b c)
<bluestorm> think hm
<mrvn> wasn't it let (<|) x f = f x?
<bluestorm> no, that would be |>
<bluestorm> the arrows goes from the value to the function
<mehdid> hi, does anyone knows how to set classic display option within myocamlbuild.ml ?
<mrvn> ok. Stupid syntax by the way.
<mehdid> is that possible ?
<bluestorm> mehdid: -classic-display
<mrvn> a (b c) is so much easier to read and type than a <| b <| c
<mehdid> bluestorm: yes this is the command line option
<bluestorm> aah, sorry
vpalle has joined #ocaml
<bluestorm> i don't know and i wouldn't suppose it's possible
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
<mehdid> bluestorm: that's what I thought ...
<bluestorm> mehdid: it seems the classic display setting is not available in the plugin API
<bluestorm> hm
<bluestorm> so <| is left-associative in F# and this kind of sucks, but at the same time it means we can reproduce their behaviour without changing ocaml standard associativity
itewsh has quit [Remote closed the connection]
vpalle has quit [Read error: 110 (Connection timed out)]
<mrvn> So f <| x <| y == f x y?
<bluestorm> yes
<bluestorm> but if you want the f .. g .. x behavior you can use f << g <| x
<bluestorm> wich is not so bad
<bluestorm> and sick guys will probably find their way with weird combinations like x |> f <| y
<mrvn> and then you have the huge problem of remembering precedence.
<bluestorm> (wich is actually not so stupide as it allows to make any function infix, kinda Haskell `f`)
realtime has quit [Remote closed the connection]
realtime has joined #ocaml
gdmfsob has joined #ocaml
mishok13 has quit [Read error: 60 (Operation timed out)]
seafood has quit [Read error: 110 (Connection timed out)]
xah_lee has quit []
itewsh has joined #ocaml
vixey has joined #ocaml
vpalle has joined #ocaml
seafood has joined #ocaml
Yoric[DT] has joined #ocaml
<thelema> hi Yoric[DT]
<Yoric[DT]> Hi
<thelema> the substring module is untested, but useful user code.
Yoric[DT] has quit [Read error: 60 (Operation timed out)]
<tsuyoshi> exception backtraces don't seem to work with anonymous functions
buzz0r__ has joined #ocaml
<thelema> tsuyoshi: if the anonymous function raises, you don't get a line number?
<tsuyoshi> well what I did was.. I passed an anonymous function to uh.. Enum.iter, which passed it to ExtArray.Array.iter, which called the anonymous function which in turn called Gzip.open_in
<tsuyoshi> open_in raised an exception, and I got a backtrace, but all it gave me was line numbers in array.ml
<thelema> curious... it might have something to do with the odd module imports done in batteries.
<tsuyoshi> nah, I'm not using batteries
<thelema> you're just using extlib? why not batteries?
<tsuyoshi> oh.. well I wrote this program on my laptop with no internet access originally
<tsuyoshi> so all I had available was what's on debian stable
<thelema> thanks for the feedback.
<thelema> it's useful to know why people don't use batteries.
<tsuyoshi> haha yeah.. I'll probably try it when the next debian release comes out
<thelema> As to the backtrace problem, it *could* be a bug - try to make a minimal example. Can it hapen with code from just two small files, etc.
<tsuyoshi> yeah.. I might try to do that
<tsuyoshi> I was only using Gzip.open_in in a couple places in the program, and I just guessed where the problem really was
<tsuyoshi> could be an osx problem too
<thelema> osx debian stable?
<tsuyoshi> nah.. I wrote the program on my linux laptop, but I'm running it on an osx server
<tsuyoshi> so.. the libraries I chose to use were constrained by debian stable.. I can compile it on my laptop but it won't actually run as it needs lots and lots of data that would not fit on my laptop
<tsuyoshi> I have found that if I try to code on a computer with internet access.. I never actually get anything done
<christian__> then try jxta
<tsuyoshi> hrm.. why haven't they put this first class modules patch into ocaml?
<christian__> its p2p protocolls available in c so...
seafood has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
<thelema> tsuyoshi: ocaml has stayed a "research language" - the creators haven't researched first class modules, so it doesn't go in.
<mrvn> thelema: isn't a class sort of a first class module?
<flux> classes cannot contain types, for one
<flux> I'm not sure how the first class modules were implemented
<flux> but I'd guess they were closer to records of functions than classes, implementation wise
<thelema> most likely the devs don't want to spend time maintaining that code.
<flux> indeed, a patch exists, I remember reading its documentation and it was nice
<tsuyoshi> it's supposed to be a very simple change
<flux> well, a patch (for 3.00) is here: http://alain.frisch.fr/info/patch_mod
<flux> 800+ lines
<tsuyoshi> ok, that's not simple
seafood has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has joined #ocaml
<flux> it could still be conceptually simple, but fiddly - but indeed, it might add to the maintenance load, if it touches everywhere
tab_ has joined #ocaml
tab has quit [Read error: 104 (Connection reset by peer)]
<mfp> tsuyoshi, flux: a large part of the patch = code being moved around (with no other changes), e.g. type module_type
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
pluribus has joined #ocaml
<tsuyoshi> hm it turns out that the stdlib hash table is rather slow when you have more elements than the array max size
<mrvn> What does it do then? keep the array size below the max and put multiple entries in each slot?
<tsuyoshi> my code is running at 6 seconds with a hash table, and .008 seconds with a map
<tsuyoshi> mrvn: right
<mrvn> well, buy a 64bit cpu.
<tsuyoshi> ha.. I'm actually running on a 64bit cpu
<tsuyoshi> but osx defaults to compiling in 32bit mode
<mrvn> and a 64bit ocaml.
<tsuyoshi> when I figured this out, I was too lazy to recompile everything
<tsuyoshi> with a judy array it runs at .004 seconds
<tsuyoshi> wonder if a 64bit hash table could beat that
<mrvn> it won't have the size problem like 32bit.
<tsuyoshi> well, it would beat the 32bit hash table for sure, but would it beat the judy array?
<mrvn> test it
<tsuyoshi> awww.. I have to recompile ocaml.. and all the libraries
<tsuyoshi> and then it will use double the memory, won't it?
sporkmonger has joined #ocaml
<thelema> more or less, yes.
<thelema> strings wouldn't change size (much), but everything else would.
<mrvn> Bigarray also remains
seafood has joined #ocaml
<tsuyoshi> oh hah.. the cf red-black trees use 1.5 times as much memory as the stdlib map
<mrvn> certainly depends on the size of the data you store.
<tsuyoshi> that is true
<tsuyoshi> hmm.. I'm using a 15-character string for the key, and an int for the data
<mrvn> maybe a prefix tree would be better
<tsuyoshi> so if the process size is 1.5 times what it is with map...
<mrvn> with a prefix/radix tree you have O(string length) access time.
<tsuyoshi> mrvn: maybe.. or maybe a b-tree instead of loading everything in memory
<mrvn> memory is cheap. As long as you don't swap.
<tsuyoshi> well.. as it is right now, the data has to be loaded every time the program runs
<tsuyoshi> which takes about 160-200 seconds
<tsuyoshi> with a b-tree that would be pretty much eliminated
<tsuyoshi> and then.. we will start moving to larger data sets
<mrvn> do you only need a small portion of the data each run?
<mrvn> a client/server concept might also work. keep the data in memory in the server.
<tsuyoshi> I don't know
<tsuyoshi> nah.. too much data to keep it all in memory
<mrvn> then B-tree is definetly the way to go
<tsuyoshi> the crazy thing is, it's all stored in flat text files right now
<flux> well, atleast it's not xml?
<mrvn> what is the data?
<tsuyoshi> I was thinking that if we did this in sql instead of ocaml it would go almost as fast.. since the database server will store everything in b-trees anyway
<tsuyoshi> mrvn: not sure.. some kind of genetic stuff
<tsuyoshi> I don't really understand what my program does.. I was just hired to make this matlab script go faster
<mrvn> so some big string or BigArray?
<tsuyoshi> no.. I was using an array at first, but that is pretty slow
<mrvn> Not array, BigArray.
<tsuyoshi> er, yeah, a big array
<tsuyoshi> bigarray
<tsuyoshi> what the inner loop does is, it takes a string of 15 characters, and then it needs to look up a number based on that string
<tsuyoshi> and there are... it ranges from 60 to 200 million entries to search through
<mrvn> I thought those 15 chars where your key.
<tsuyoshi> ok... what it does is
<tsuyoshi> it reads lines of text from a file
<tsuyoshi> for each line, it takes every 15-character substring of that line, and counts how many times each substring occurs
<tsuyoshi> that part is easy, the lines are only 1000 characters or so
<mrvn> then you should create a suffix tree.
<tsuyoshi> then for each 15-character substring, you look up in this database (60-200 million entries) a number, and then do some formula based on the number you look up, and the count within the line
Yoric[DT] has joined #ocaml
<tsuyoshi> the matlab code is rather tortured, but I think this would be a one-liner in sql
<tsuyoshi> well.. getting the substrings is a bit harder
<mrvn> select num from table where key = string
<tsuyoshi> but anyway I've done much more difficult stuff in sql before
<tsuyoshi> is there a library that implements prefix trees for ocaml? or even for c?
<tsuyoshi> you know actually berkeley db does it.. you can tell it how much of the beginning of two keys is identical, and then it only stores the parts that are different
<mrvn> A suffixtree can be done in C with ~20*n memory.
<mrvn> So 20k per file.
<mrvn> aeh, line
<mrvn> Does that still exceed your memory?
<tsuyoshi> well the input files are not where the memory is going
<tsuyoshi> it's going toward the database
<tsuyoshi> but the funny thing was, it took about 20 seconds for matlab to count the substrings
<bluestorm> (i know of a suffix tree implementation in OCaml by filliatre)
<tsuyoshi> in ocaml I just loaded them into a map and I couldn't even measure how long it took, it was less than a millisecond
<mrvn> maybe you can put your DB into a radix tree too.
<tsuyoshi> what's a radix tree?
<mrvn> at each node you have a number of bits that all children have in common and then children that continue with a 0 bit left and 1 bit right.
<mrvn> The big advantage is that you don't store a full key in each node and don't have to compare it all the time. You look at every bit of the key exactly once.
<mrvn> (when you search)
<tsuyoshi> hmm.. I think a judy array is probably faster
<Yoric[DT]> thelema: well, if we are to include that module, it needs to be commented.
<Yoric[DT]> Do you wish to handle this task>
<Yoric[DT]> Do you wish to handle this task?
<mrvn> sounds like it is a radix tree with some complexity added for cache line efficiency.
<mrvn> or maybe a combination of radix tree and B-tree.
<mrvn> *bookmarking for later study*
<flux> did ocaml rains library support compositin datastructures?
pluribus has left #ocaml []
ikaros has joined #ocaml
anoopr has joined #ocaml
<anoopr> does anyone have a moment to help a beginner with a compilation problem?
pango has quit [Remote closed the connection]
<mrvn> anoopr: it helps if you would state your problem.
<anoopr> i'm trying to make a Trie
<anoopr> lemme get the code and the error
<anoopr> and the error is
<anoopr> File "/Users/anoop/Desktop/janestreet/SpellTrie.ml", line 14, characters 40-50:
<anoopr> This expression has type 'a Trie.t = 'a Map.Make(Char).t
<anoopr> but is here used with type 'a Trie.t Trie.t = 'a Trie.t Map.Make(Char).t
<anoopr> Type 'a is not compatible with type 'a Trie.t = 'a Map.Make(Char).t
<anoopr> line 14, characters 40-50 are the child_node portion of line 14
anoopr has left #ocaml []
anoopr has joined #ocaml
<anoopr> oh, i think i have it. sorry to bother everyone!
anoopr has left #ocaml []
ched has quit ["Ex-Chat"]
vpalle has quit [Read error: 110 (Connection timed out)]
<hcarty> bluestorm: Would you use pa-do or "raw" camlp4 for the <| and |> implementation and optimization in Batteries?
ched has joined #ocaml
seafood has quit []
<bluestorm> hcarty: actually
<bluestorm> now that i checked the F# associativity, i believe that raw definitions would be just fine
<bluestorm> but the idea to inline using camlp4 is still good, though i'm not sure it's possible to do that sanely
<bluestorm> (what if the user redefines the infix operator ? I'm not sure a syntax extension can handle that)
<hcarty> There is an example in the ocaml sources, and in pa-do (two different methods, somewhat obviously)
<hcarty> Yes, it would probably be best as a separate and user-specified extension if it were included
Jedai has joined #ocaml
<bluestorm> so that he could activate it on sources he's confident don't use the operators for other purposes ?
<bluestorm> that's what i was thinking
<hcarty> Yes
<hcarty> More an extra optimization pass than anything else, I suppose
<hcarty> bluestorm: ocaml-3.11.0/camlp4/examples/apply_operator.ml in the main distribution
<hcarty> bluestorm: pa-do/examples/pa_compos.ml in pa-do
<bluestorm> there is also the problem that the obvious inlining for |> changes the evaluation order
<hcarty> ( & ) and ( $ ) work, but they don't indicate direction as nicely and they clash with other things
<bluestorm> and $ is left-associative so couldn't be used as Haskell's one
<bluestorm> (<| can't either but at least we aren't fooling anybody)
<bluestorm> i've considered using & and @$ and dropping the double-direction-thing though
<hcarty> No, $ would be (I think?) the oppposite of Haskell
<bluestorm> Haskell-$ is F#-<|
<hcarty> Ok, I thought it was something like that
<hcarty> I've never done much with Haskell
<hcarty> JoCaml uses &, so I don't know if that would cause long-term problems
<bluestorm> and camlp4 use $
<bluestorm> and @$ is quite strange and not shorter to write than <|
<bluestorm> hcarty: i considered pa_do for other things recently
<bluestorm> when designing my pa_comprehension extension, i asked myself if i could use pa_do to have something like Module.[? foo | foo <- bar ] instead of [? Module : foo | foo <- Module : bar ]
<hcarty> bluestorm: I'm not sure if there is built-in support for something other than Module.() syntax. There is support in the API for arbitrary rewriting within the () though.
<bluestorm> i've seen the arbitrary rewrite thing
<bluestorm> but i'm afraid camlp4 ocaml grammar doesn't have a notion of "enclosing braces" that would make that sort of thing easy to do
<hcarty> That's unfortunate
anoopr has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
jlouis has quit [brown.freenode.net irc.freenode.net]
TaXules has quit [brown.freenode.net irc.freenode.net]
TaXules has joined #ocaml
jlouis has joined #ocaml
ched has quit [Remote closed the connection]
ched has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
Yoric[DT] has joined #ocaml
mohbana has joined #ocaml
<mohbana> hi, could someone please summarise what's happening with the ocaml implementation on the JVM and is it o'caml or ocaml
ikaros has quit [".quit"]
<bluestorm> mohbana: for the spelling thing, see http://caml.inria.fr/resources/doc/faq/general.en.html#name-case
<bluestorm> the ocaml implementation on the JVM is working but unoptimized (and it's difficult to have something very efficient because of the limitations of the JVM for functional things, GC and tail calls for example), and there is a website about that
jonasb has joined #ocaml
bluestorm has quit [Remote closed the connection]
<mohbana> i've seen people write o'caml
Snark has quit ["Ex-Chat"]
xah_lee has joined #ocaml
mrvn has quit [Read error: 104 (Connection reset by peer)]
mrvn has joined #ocaml
smimram has quit [Read error: 110 (Connection timed out)]
vpalle has joined #ocaml
smimram has joined #ocaml
mohbana has quit [Read error: 110 (Connection timed out)]
mrvn has quit [Read error: 60 (Operation timed out)]
mohbana has joined #ocaml
<mohbana> any more thoughtrs
mrvn has joined #ocaml
anoopr has quit []
aard7 has joined #ocaml
aard7 has quit [Client Quit]
arokc has joined #ocaml
vpalle has quit [Connection timed out]
Associat0r has joined #ocaml
<mohbana> aside from being optimised are there any other issues
<mohbana> i've been reading the ML and it seems tail calls are supportedo n the JVM now
hkBst has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
hkBst has joined #ocaml
mrvn has quit [Read error: 60 (Operation timed out)]
<vixey> mohbana :(
<vixey> mohbana, does this mean I can't use java anymore as a way to explain aspects of TCO?
bluestorm has joined #ocaml
smimou_ has joined #ocaml
pierre- has quit [Read error: 110 (Connection timed out)]
smimram has quit [Read error: 110 (Connection timed out)]
Camarade_Tux has quit ["Leaving"]
pango has joined #ocaml
hsuh has joined #ocaml
mrvn has joined #ocaml
<hsuh> hi... i
<hsuh> i'm trying to profile some code.... even though it takes about 1 sec to run, gprof output shows 0 secs for all functions.. any ideas?
<hsuh> hm it also says "granularity: each sample hit covers 4 byte(s) no time accumulated"...
<mrvn> How much time do you think you can optimize out of that second and how much time will you waste doing so?
<hsuh> yeah, programmer time is more expensive i know :) buts its been years since i last profiled something and it takes a little bit more on my windows machine at work
<hsuh> (for fun only)
<hsuh> (and i
<hsuh> and i'd also run it dozens of time a day, so...
itewsh has joined #ocaml
vpalle has joined #ocaml
slash_ has joined #ocaml
bluestorm has quit [Remote closed the connection]
seafood has joined #ocaml
buzz0r__ has quit [Read error: 110 (Connection timed out)]
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
seafood has quit []
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
hkBst has quit [Read error: 104 (Connection reset by peer)]
vpalle has quit [Read error: 110 (Connection timed out)]
mohbana has quit [Read error: 60 (Operation timed out)]
mohbana has joined #ocaml
kg4qxk has quit [Read error: 113 (No route to host)]
arokc has quit []
christian__ has quit [Read error: 113 (No route to host)]
vixey has quit [Client Quit]