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
BiD0rD has quit [Read error: 110 (Connection timed out)]
BiD0rD has joined #ocaml
sporkmonger has quit []
monadic_kid has quit ["Leaving"]
willb has joined #ocaml
vuln has joined #ocaml
seafood has joined #ocaml
ched__ has joined #ocaml
ched_ has quit [Read error: 110 (Connection timed out)]
AxleLonghorn has joined #ocaml
komar_ has joined #ocaml
orbitz_ has joined #ocaml
orbitz_ has quit [Client Quit]
vuln has quit ["leaving"]
orbitz has joined #ocaml
orbitz has quit [Client Quit]
orbitz has joined #ocaml
Skolem has quit [hubbard.freenode.net irc.freenode.net]
bebui has quit [hubbard.freenode.net irc.freenode.net]
dav has quit [hubbard.freenode.net irc.freenode.net]
lutter has quit [hubbard.freenode.net irc.freenode.net]
gl has quit [hubbard.freenode.net irc.freenode.net]
gl has joined #ocaml
Skolem has joined #ocaml
bebui has joined #ocaml
dav has joined #ocaml
lutter has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
m3ga has joined #ocaml
Hhhhh has joined #ocaml
<Hhhhh> hi just a couple of questions
<Hhhhh> is multicore parallelism supported by current ocaml implementations?
<m3ga> no, it isn't
<Hhhhh> hmm
<Hhhhh> do you know of any functional languages that do?
<Hhhhh> I mean, implementations of*
<m3ga> there are a couple of add ons like cothreads, jocaml etc. not widely used
<m3ga> erlang is the obvious one
<Hhhhh> how efficient and well-maintained are jocaml and cothreads?
<m3ga> sorry, don't know.
m3ga has quit ["disappearing into the sunset"]
vuln has joined #ocaml
orbitz has left #ocaml []
<det> Hhhhh, you can achieve multi-core parallelism, just not with shared memory threads
<det> You can do, fork + messege passing or processes + messege passing
AxleLonghorn has quit [Read error: 110 (Connection timed out)]
Hhhhh has quit ["This computer has gone to sleep"]
Associat0r has quit []
Camarade_Tux has joined #ocaml
<flux> the guy left, but apparently jocaml people have kept their word and they are up-to-date to 3.11
<flux> some day (TM) I shall try out how jocaml deals with tons of threads
<flux> (or some comparable concept)
<flux> kaustuv, did you have some practical opposition to `Const, or just philosophical?-)
<flux> ..not to disregard philosophical problems, but..
Camarade_Tux has quit ["Leaving"]
mrvn has quit [hubbard.freenode.net irc.freenode.net]
bjorkintosh has quit [hubbard.freenode.net irc.freenode.net]
r0bby has quit [hubbard.freenode.net irc.freenode.net]
r0bby has joined #ocaml
mrvn has joined #ocaml
bjorkintosh has joined #ocaml
Alpounet has joined #ocaml
mlbot has joined #ocaml
vuln has quit ["leaving"]
komar_ has quit [Remote closed the connection]
komar_ has joined #ocaml
sanguine1 is now known as sanguinev
_zack has joined #ocaml
munga` is now known as munga
seafood has quit []
slash_ has quit [Client Quit]
olegfink is now known as of
komar_ is now known as k_
k_ is now known as komar_
komar_ is now known as k_
Alpounet has quit ["Quitte"]
mlbot has quit [Remote closed the connection]
k_ is now known as _
_ is now known as Guest18197
Guest18197 is now known as k_
k_ is now known as komar_
jeanbon has joined #ocaml
of is now known as olegfink
itewsh has joined #ocaml
itewsh has quit [Client Quit]
verte has joined #ocaml
Associat0r has joined #ocaml
Associat0r has quit [Client Quit]
LeCamarade has joined #ocaml
jeanbon has quit ["EOF"]
Yoric has joined #ocaml
jado has joined #ocaml
verte has quit [":("]
yziquel has joined #ocaml
jonafan has joined #ocaml
jonafan_ has quit [Read error: 110 (Connection timed out)]
komar_ has quit [Remote closed the connection]
komar_ has joined #ocaml
jado_ has joined #ocaml
<yziquel> > let f x = (print_int 1; x); Lazy.force (lazy (f 2)); Lazy.force (lazy (f 2));;
<yziquel> Is there a built-in (somewhere) replacement for this call to lazy that would print 1 only the first time?
jado has quit [Read error: 101 (Network is unreachable)]
jado__ has joined #ocaml
jado_ has quit [Read error: 60 (Operation timed out)]
<olegfink> yziquel: pa_memo?
<olegfink> er, not built-in
<yziquel> hmmm...
<thelema> yziquel: let f () = print_int 1; fun x -> x
<yziquel> what's the time complexity of hashtbl, with respect to the data to hash?
<thelema> hashtbl is O(1), like all hashtables
ztfw has joined #ocaml
<kaustuv> O(1) amortized
<mellum> nope, O(1) expeced
<mrvn> Hashing itself can also be expensive depending on your datatype.
<thelema> but the default hashing function has bounded complexity
<flux> thelema, not only bounded by the number of pointers it follows? how fast is hashing an array of 100000 elements?
<mrvn> flux: doesn't that stop after m nodes?
<flux> mrvn, I don't know
<mrvn> Hashing performs a depth-first, right-to-left traversal of the structure x, stopping after n meaningful nodes were encountered, or m nodes, meaningful or not, were encountered.
<mrvn> I assume the default hash uses some default values to call hash_param
<flux> well, atleast while creating 16M element array takes a noticeable time, hashing it doesn't
<mrvn> I wonder if a 16M string takes long to hash
<mrvn> The docs say chars are meaningfull nodes but do strings count as String.length chars?
willb has joined #ocaml
jado__ has quit [Remote closed the connection]
<Skolem> Is there any syntax to initialize a map with a bunch of key/value pairs at once?
<mrvn> Skolem: Do you see one in file:///usr/share/doc/ocaml/docs/ocaml.html/libref/Map.Make.html ?
ztfw` has joined #ocaml
<flux> you can do it with List.fold_left
<flux> also I'd venture batteries' Map has some of_enum/of_list function
<Skolem> Thanks.
<mrvn> I guess one could make something more efficient given a sorted list or array than List.fold_left.
<flux> perhaps just choosing an optimal order for insertion is sufficient, prior to calling List.fold_left
<flux> I don't know what is the optimal order though :)
<flux> perhaps random would be good. but shuffling a list randomly would take time..
<mrvn> insert the middle one and recurse for the left and right chunks?
<flux> I wonder how much work you actually save if you try to reorder the data that way
<flux> it might make sense if a campl4 module preorders your map literal, if there was such an extension
<Skolem> I'm just trying to learn Ocaml by converting some of my simple Perl programs. The one I'm working on now starts by initializing a hash: my %hash = (key1 => val1, key2 => val2, ..., keyN => valN). I was hoping for a convenient analogue in OCaml.
<flux> but a camlp4 module should be able to build the tree directly via some secret interface
<mrvn> Should avoid rebalancing the tree.
<Skolem> I think the fold_left thing looks easiest.
<flux> skolem, well, you need to do something like (I'm not testing this, so it'll might have syntax errors): module ExtendedMap (M : Map.S) = struct include M let of_list l = List.fold_left (fun map key value -> add key value map) empty l end and then module M = ExtendedMap(Map.Make(struct type t = int let compare = compare end))
<flux> or you could parametrize the functor directly with the OrderedType
<flux> fun map (key, value)
<Skolem> Wow, OK.
<Skolem> I say "Wow" because that looks like a lot of machinery.
<mrvn> or just use the of_list part directly without defining a new module.
<Skolem> I'm familiar with Perl, Ruby, C, and Lisp, and all of them have built-in syntax for initializing a bunch of records at once.
<Skolem> F# has Map.of_list :/
l_a_m has joined #ocaml
<Yoric> Skolem: use PMap instead of Map.
<Yoric> It has of_enum .
<Yoric> (and actually, so does Map, but there's more machinery)
ztfw has quit [Connection timed out]
<Yoric> There's a good reason for Map to have more machinery: the type system is able to tell you when you're attempting to use two different maps with the same apparent type but with different comparison functions.
<Yoric> PMap is a simpler version of Map which doesn't have this feature. It's easier to use, just not as safe.
<palomer> C has built-in syntax for records?
ztfw`` has joined #ocaml
<Skolem> I suppose C wasn't a good comparison. I was thinking of the syntax for initializing an array of structures, but that's not the same thing at all
<palomer> perl and ruby have built-in syntax for practically everything
<palomer> and some lisps don't have any concept of records
<Skolem> Yeah, i guess an association list IS a poor sbustitute.
<palomer> ocaml has built in syntax for association list: [(a,b);(c,d)]
<kaustuv> ah, but a and the c, and the b and the d, are of the same type
<kaustuv> in other words, nothing like alists from lisp/scheme
<palomer> true true
<palomer> or ruby
<kaustuv> I suppose it's the same in Lisp/Scheme also, but only by accident of everything having the same type
<palomer> ruby has some pretty wicked map syntax
Yoric has quit ["Ex-Chat"]
ztfw``` has joined #ocaml
ztfw``` has quit [Remote closed the connection]
ztfw` has quit [Read error: 110 (Connection timed out)]
_andre has joined #ocaml
ztfw`` has quit [Read error: 110 (Connection timed out)]
jeanbon has joined #ocaml
<palomer> hrmph
<palomer> you guys wouldn't know how to italicize/underline characters with camomile, would you?
willb has quit [Read error: 110 (Connection timed out)]
willb has joined #ocaml
Amorphous has quit [Connection reset by peer]
_zack has quit ["Leaving."]
Amorphous has joined #ocaml
marteo has joined #ocaml
<marteo> hello
<marteo> can I paste a few code ?
<hcarty> marteo: Paste to a code pasting site, ex: ocaml.pastebin.com
<hcarty> marteo: Then post a link here with your question(s)
<marteo> the third argument is declared as 'used with type int*int, but of type int
<marteo> the function must give an int and the remaining list, without the 't' elements at the beginning
ttamttam has joined #ocaml
<hcarty> marteo: val aux : 'a list -> int -> 'a -> int * 'a list = <fun> is what I get here when entering it in the toplevel
ttamttam has left #ocaml []
<hcarty> marteo: And seems to work as expected
<marteo> hcarty, yes but try aux [2,1] 0 2 ;;
<marteo> on mine he gives an error
<hcarty> marteo: Yes
<hcarty> Because you typed in the list as a "(int * int) list" rather than an "int list"
<hcarty> marteo: aux [2;1] 0 2;; works as expected
<marteo> Oo
<marteo> aaaaah okay
<marteo> I'm sorry, newbie error
<marteo> thank you very much
<hcarty> marteo: It's ok, errors like this are part of starting out in a new language :-)
<marteo> :)
<kaustuv> <palomer> how to italicize/underline characters with camomile
<kaustuv> I don't think Unicode could do fonty stuff like underlining and italics
<kaustuv> but if you're printing to a terminal you can do underlining with escape codes
palomer has quit [Remote closed the connection]
LeCamarade has quit ["Gone."]
psnively has joined #ocaml
<flux> and italic and boldin depending on the terminal
Mr_Awesome has quit [Remote closed the connection]
Mr_Awesome has joined #ocaml
monadic_kid has joined #ocaml
jeanbon has quit [Nick collision from services.]
jeanb-- has joined #ocaml
jeanb-- is now known as jeanbon
monadic_kid has quit ["Leaving"]
_andre has quit ["Lost terminal"]
palomer has joined #ocaml
<palomer> whew
<palomer> time to rewrite all my code
<palomer> woot!
Yoric[DT] has joined #ocaml
<mrvn> palomer: 2nd, 3rd or 4th time?
<palomer> 12th or so
<palomer> :P
<palomer> but this is my third quasi complete rewrite
<palomer> I have type foo = bar in some module, but I don't want people using my module to know that foo = bar
<mrvn> then put type foo in the mli
<palomer> hrmph, that means writing an mli
<palomer> which is a pain considering im constantly rewriting my code
<mrvn> ocamlc/opt -i >foo.mli
<mrvn> was there something like type foo = private bar?
<palomer> err, would that do the trick too?
<mrvn> Error: Unbound type constructor bar
monadic_kid has joined #ocaml
<mrvn> wrong syntax or it just doesn't exist for types.
<palomer> wait, that's 3.11
<palomer> im using 3.10
ttamttam has joined #ocaml
jeanb-- has joined #ocaml
jeanbon has quit [Nick collision from services.]
jeanb-- is now known as jeanbon
ttamttam has left #ocaml []
smimram has quit [Read error: 110 (Connection timed out)]
smimram has joined #ocaml
Fullma` has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
yziquel has quit ["http://www.mibbit.com ajax IRC Client"]
monadic_kid has quit ["Leaving"]
AxleLonghorn has joined #ocaml
Fullma has quit [Connection timed out]
<AxleLonghorn> is there any way to make this code faster?
<AxleLonghorn> the attempt is to read in a file and count the number of times a word appears
<AxleLonghorn> it's really fast already
<AxleLonghorn> it can read 16 copies of Call of the Wild in "real 0m3.478s" on my 900 mhz intel celeron processor
<det> You might try accumulating in a list and then sorting instead of using a hash table
<det> Im not sure if it would be faster or slower
<psnively> My guess is that read_line is suboptimal and breaking words down using regexes likewise.
<det> Also, you should probably just convert to lowercase each word
<AxleLonghorn> that's 54897 calls to the ``hash_line'' function
<det> before inserting in the hash table
<det> instead of replacing it in the whole line using a regexp
<AxleLonghorn> likewise to read_line
AxleLonghorn has left #ocaml []
AxleLonghorn has joined #ocaml
willb has joined #ocaml
marteo has quit ["Debian GNU/Hurd is Good."]
Ariens_Hyperion has joined #ocaml
BiD0rD has quit [Read error: 60 (Operation timed out)]
jeanbon has quit [Read error: 110 (Connection timed out)]
BiD0rD has joined #ocaml
komar_ has quit [Remote closed the connection]
hlab has joined #ocaml
willb has quit [Read error: 60 (Operation timed out)]
<palomer> it's so nice outside!
Yoric[DT] has quit ["Ex-Chat"]
<aij> AxleLonghorn: if you're still working on it, you may want to make your concord function tail recursive (by either moving the try outside the recursive function, or by moving the recursion outside the try)
<aij> AxleLonghorn: it probably wouldn't be much faster, but it would let you read big files without a stack overflow
jonafan has quit [Read error: 104 (Connection reset by peer)]
mjambon has joined #ocaml
Camarade_Tux has joined #ocaml
mikaz has joined #ocaml
<mikaz> tumbleweed
<mjambon> very constructive.
<mikaz> the wind blows through the skirts of the city
<mikaz> arousing the loins of the populace.
<mikaz> tap tap tap. is this thing on?
<AxleLonghorn> I'll see what it does aij, thanks for the help
<aij> AxleLonghorn: also, is it just me, or would the global_replace turn every line into a single word?
<AxleLonghorn> oh crap, you're right
monadic_kid has joined #ocaml