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
seafood has joined #ocaml
jeanbon has quit ["J'y trouve un goût d'pomme."]
Yoric[DT] has quit ["Ex-Chat"]
Camarade_Tux has joined #ocaml
kaustuv_ has quit [Read error: 113 (No route to host)]
Proteus_ has joined #ocaml
tar_ has joined #ocaml
Proteus has quit [Read error: 110 (Connection timed out)]
hkBst has quit [Read error: 104 (Connection reset by peer)]
Camarade_Tux has quit ["Leaving"]
Ched has quit [Read error: 110 (Connection timed out)]
Ched has joined #ocaml
seafood has quit []
jeddhaberstro has quit []
jknick has quit ["leaving"]
JohnnyL has joined #ocaml
JohnnyL has left #ocaml []
sanguinev has quit [Read error: 110 (Connection timed out)]
tar_ has quit []
hastake_ has joined #ocaml
hastake has quit [Read error: 104 (Connection reset by peer)]
tarbo2 has quit [Read error: 60 (Operation timed out)]
CoryDambach has quit ["Leaving"]
tarbo2 has joined #ocaml
Proteus_ has quit ["Leaving"]
seafood has joined #ocaml
r0bby_ is now known as r0bby
Yoric[DT] has joined #ocaml
Alpounet has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
ttamttam has joined #ocaml
Camarade_Tux has joined #ocaml
pierre_m has joined #ocaml
_zack has joined #ocaml
s4tan has joined #ocaml
deadc0de has joined #ocaml
deadc0de has quit [Remote closed the connection]
rwmjones_ has joined #ocaml
pierre_m has left #ocaml []
jeremiah has joined #ocaml
rwmjones_ has quit [Read error: 131 (Connection reset by peer)]
hardcoding has joined #ocaml
<hardcoding> Hello ! I would like to create a recursive function which returns the number of 0 in an int list, can somebody help me to do that? ^^
<mrvn> what is your problem with that?
<mfp> mrvn: homework is hard, let's go shopping?
<hardcoding> mrvn, I am new to OCAML and I encounter some difficulty for the syntax, I start with : le rec nb = function n -> if n = [] then 0 else and now I'm stuck
<mfp> hardcoding: have you been taught pattern matching?
<mfp> +yet
<hardcoding> yes
<hardcoding> well, theoritically lol
<hardcoding> (my nb function takes an int list and returns an int)
<mfp> so you know how to deconstruct a list, you have the base case [] -> 0, and also know about recursive functions, you're almost there :)
<mrvn> you want to use a helper function. You need the number of zeroes you already counted in the recursion.
<mrvn> at least if it is to be tail recursive.
<mrvn> .oO(lets start without it)
<mfp> they probably don't ask for tail recursion at this point
<mrvn> just realized that :)
<hardcoding> I know about hd and tl
<mrvn> hardcoding: ever seen let fac = function 0 -> 1 | n -> n * (fac (n - 1)) ?
<hardcoding> yes
<hardcoding> my problem is the list I think, otherwise I'm okay with recursivity
<mrvn> That is patter matching. You can do that with any structure.
<mrvn> function [] -> 0 | ....
<hardcoding> yeah match n with
<mrvn> let rec nb list = match list with is the same as let rec nb = function
<hardcoding> yes
<hardcoding> my problem is the syntax with the list though, I want to translate, if e = 0 then count it as one else continue with hd(tl(list)) and if it's 0 then continue etc
<hardcoding> and return the number of 0 counted
<mrvn> You don't use hd/tl. You use pattern matching for that.
<mrvn> hardcoding: An empty list has 0 zeroes. A list begining with a zero has 1 more zeroes than the remainder and any other list has as many as the remainder has.
<hardcoding> function [] -> 0 | e::r -> if e = 0 then 1 + n
<hardcoding> else unit()
<mrvn> Where is the recursion in that?
<hardcoding> will it not continue looking for the next next first element?
<hardcoding> -next*
<mrvn> why should it? You didn't tell it to
<hardcoding> I thought my + n was enough, let me think.
<mrvn> and where should your magical n come from?
<hardcoding> oh there would be an error anyway because my variable is n
<mrvn> your else is also totaly wrong
<hardcoding> because unit() isn't an int?
<mrvn> for one thing.
<hardcoding> isn't my goal, by using pattern matching, not to use a conditionnal expression anyway?
<mrvn> hardcoding: I would
<mrvn> In thiscaseyou can easily merge the test for 0 into the pattern
<mrvn> In this case you can easily merge the test for 0 into the pattern. (bad space key)
<hardcoding> function [] -> 0 | e::r -> if e = 0 then 1 else 0
<mrvn> Again where is your recursion?
hkBst has joined #ocaml
<hardcoding> I know !!! nb(e::r) -> if e = 0 then 1 else 0?
<hardcoding> :D
<mrvn> You should try entering your code in the toplevel before you paste it.
<mrvn> schme: dann frag upstream oder upload ein +git... oder beides.
<mrvn> ups, ECHAN
jamii has quit [calvino.freenode.net irc.freenode.net]
kaustuv has quit [calvino.freenode.net irc.freenode.net]
maxote has quit [calvino.freenode.net irc.freenode.net]
s4tan has quit [calvino.freenode.net irc.freenode.net]
mal`` has quit [calvino.freenode.net irc.freenode.net]
kg4qxk has quit [calvino.freenode.net irc.freenode.net]
hkBst has quit [calvino.freenode.net irc.freenode.net]
_zack has quit [calvino.freenode.net irc.freenode.net]
jlouis has quit [calvino.freenode.net irc.freenode.net]
r0bby has quit [calvino.freenode.net irc.freenode.net]
kelaouchi has quit [calvino.freenode.net irc.freenode.net]
mfp has quit [calvino.freenode.net irc.freenode.net]
Mr_Awesome has quit [calvino.freenode.net irc.freenode.net]
petchema has quit [calvino.freenode.net irc.freenode.net]
bohanlon has quit [calvino.freenode.net irc.freenode.net]
TaXules has quit [calvino.freenode.net irc.freenode.net]
svenl_ has quit [calvino.freenode.net irc.freenode.net]
brendan has quit [calvino.freenode.net irc.freenode.net]
seafood has quit [calvino.freenode.net irc.freenode.net]
mwhitney has quit [calvino.freenode.net irc.freenode.net]
det has quit [calvino.freenode.net irc.freenode.net]
l_a_m has quit [calvino.freenode.net irc.freenode.net]
mishok13 has quit [calvino.freenode.net irc.freenode.net]
schme has quit [calvino.freenode.net irc.freenode.net]
bjorkintosh has quit [calvino.freenode.net irc.freenode.net]
Asmadeus has quit [calvino.freenode.net irc.freenode.net]
xevz has quit [calvino.freenode.net irc.freenode.net]
hcarty has quit [calvino.freenode.net irc.freenode.net]
acatout has quit [calvino.freenode.net irc.freenode.net]
Hadaka has quit [calvino.freenode.net irc.freenode.net]
rwmjones has quit [calvino.freenode.net irc.freenode.net]
bacam has quit [calvino.freenode.net irc.freenode.net]
totom has quit [calvino.freenode.net irc.freenode.net]
jedai has quit [calvino.freenode.net irc.freenode.net]
munga has quit [calvino.freenode.net irc.freenode.net]
xian has quit [calvino.freenode.net irc.freenode.net]
jeremiah has quit [calvino.freenode.net irc.freenode.net]
Camarade_Tux has quit [calvino.freenode.net irc.freenode.net]
peper has quit [calvino.freenode.net irc.freenode.net]
ttamttam has quit [calvino.freenode.net irc.freenode.net]
thelema has quit [calvino.freenode.net irc.freenode.net]
shortc|desk has quit [calvino.freenode.net irc.freenode.net]
olegfink has quit [calvino.freenode.net irc.freenode.net]
authentic has quit [calvino.freenode.net irc.freenode.net]
flx_ has quit [calvino.freenode.net irc.freenode.net]
mbishop has quit [calvino.freenode.net irc.freenode.net]
ppsmimou has quit [calvino.freenode.net irc.freenode.net]
sitaktif has quit [calvino.freenode.net irc.freenode.net]
tsuyoshi has quit [calvino.freenode.net irc.freenode.net]
ski__ has quit [calvino.freenode.net irc.freenode.net]
ozzloy has quit [calvino.freenode.net irc.freenode.net]
tomaw has quit [calvino.freenode.net irc.freenode.net]
gildor has quit [calvino.freenode.net irc.freenode.net]
ertai has quit [calvino.freenode.net irc.freenode.net]
mrvn has quit [calvino.freenode.net irc.freenode.net]
hardcoding has quit [calvino.freenode.net irc.freenode.net]
holgr has quit [calvino.freenode.net irc.freenode.net]
sbok has quit [calvino.freenode.net irc.freenode.net]
bartiosze has quit [calvino.freenode.net irc.freenode.net]
Ori_B has quit [calvino.freenode.net irc.freenode.net]
tab has quit [calvino.freenode.net irc.freenode.net]
jonafan has quit [calvino.freenode.net irc.freenode.net]
smimram has quit [calvino.freenode.net irc.freenode.net]
delroth has quit [calvino.freenode.net irc.freenode.net]
burton_ has quit [calvino.freenode.net irc.freenode.net]
fremo has quit [calvino.freenode.net irc.freenode.net]
tarbo2 has quit [calvino.freenode.net irc.freenode.net]
Amorphous has quit [calvino.freenode.net irc.freenode.net]
thelema_ has quit [calvino.freenode.net irc.freenode.net]
haelix has quit [calvino.freenode.net irc.freenode.net]
infoe|wk has quit [calvino.freenode.net irc.freenode.net]
patronus has quit [calvino.freenode.net irc.freenode.net]
ido has quit [calvino.freenode.net irc.freenode.net]
hkBst has joined #ocaml
hardcoding has joined #ocaml
jeremiah has joined #ocaml
s4tan has joined #ocaml
_zack has joined #ocaml
Camarade_Tux has joined #ocaml
ttamttam has joined #ocaml
seafood has joined #ocaml
tarbo2 has joined #ocaml
jlouis has joined #ocaml
mwhitney has joined #ocaml
Amorphous has joined #ocaml
thelema_ has joined #ocaml
r0bby has joined #ocaml
kelaouchi has joined #ocaml
det has joined #ocaml
mfp has joined #ocaml
schme has joined #ocaml
smimram has joined #ocaml
Mr_Awesome has joined #ocaml
thelema has joined #ocaml
jedai has joined #ocaml
brendan has joined #ocaml
jamii has joined #ocaml
peper has joined #ocaml
gildor has joined #ocaml
holgr has joined #ocaml
shortc|desk has joined #ocaml
delroth has joined #ocaml
ertai has joined #ocaml
maxote has joined #ocaml
kaustuv has joined #ocaml
xevz has joined #ocaml
hcarty has joined #ocaml
burton_ has joined #ocaml
olegfink has joined #ocaml
mrvn has joined #ocaml
munga has joined #ocaml
jonafan has joined #ocaml
authentic has joined #ocaml
flx_ has joined #ocaml
mbishop has joined #ocaml
kg4qxk has joined #ocaml
mal`` has joined #ocaml
TaXules has joined #ocaml
svenl_ has joined #ocaml
bohanlon has joined #ocaml
petchema has joined #ocaml
bjorkintosh has joined #ocaml
ppsmimou has joined #ocaml
l_a_m has joined #ocaml
sitaktif has joined #ocaml
totom has joined #ocaml
haelix has joined #ocaml
Asmadeus has joined #ocaml
Hadaka has joined #ocaml
mishok13 has joined #ocaml
infoe|wk has joined #ocaml
acatout has joined #ocaml
bacam has joined #ocaml
sbok has joined #ocaml
patronus has joined #ocaml
ido has joined #ocaml
tab has joined #ocaml
Ori_B has joined #ocaml
bartiosze has joined #ocaml
fremo has joined #ocaml
rwmjones has joined #ocaml
xian has joined #ocaml
tomaw has joined #ocaml
ski__ has joined #ocaml
ozzloy has joined #ocaml
tsuyoshi has joined #ocaml
<tsuyoshi> let count_zeros l = let rec loop l n = match l with [] -> n | x :: y when x = 0 -> loop y (n + 1) | _ :: y -> loop y n
<tsuyoshi> oh.. that's wrong
<tsuyoshi> but close enough...
<mrvn> tsuyoshi: plus we waved the tail recursiveness as "not yet learned"
<hardcoding> why?
<mrvn> tsuyoshi: let nb = List.fold_left (fun n x -> if x = 0 then n + 1 else n) 0;;
<mrvn> hardcoding: tail recursive it is more complicated
<hardcoding> Where can I learn about it mrvn ?
<mrvn> hardcoding: ask your tutor in the next class
<tsuyoshi> you mean as opposed to uh.. regular recursive?
<mrvn> tsuyoshi: as opposed to "don't care recursive" :)
<hardcoding> lol I doubt my maths or physics teacher can help me Mr_Awesome
<hardcoding> mrvn,
<tsuyoshi> I don't even know how to write that without using tail recursion
<mrvn> isn't this a class asignment?
<hardcoding> no
<hardcoding> it isn't
<tsuyoshi> let me think
<hardcoding> please explain to me what tail recursion is
<tsuyoshi> tail recursion is where you return the result of a function without doing anything to it
<mrvn> well, then here we go: let rec nb = function [] -> 0 | 0::xs -> 1 + (nb xs) | _::xs -> nb xs
<tsuyoshi> the compiler can optimize a function call like that into a jump
<mrvn> Which means it won't have to use stack for the recursion and the recursion depth won't be limied by the stack.
<tsuyoshi> like let rec foo () = foo ()
<tsuyoshi> that will run forever, instead of using up all the stack
<hardcoding> oh the error stack overflow is thus avoided right>?
<hardcoding> ?
<tsuyoshi> or let rec foo () = bar () and bar () = foo ()
<mrvn> on the other hand let rec foo () = 1 + foo () will eatstack and fail.
<mrvn> hardcoding: yes.
<mrvn> hardcoding: If you want to be able to count the zeroes in verry long lists then you need to write the code tail recursive. Otherwise it will run out of stack.
<hardcoding> Ok I see! I thought that to avoid a stack overflow the only condition was not to forget the base case
<mrvn> hardcoding: No. You can easily have cases where you run out of stack with totally correct code.
<mrvn> hardcoding: You can only do a few thousand recursions on the stack or so.
<mrvn> depending on how much stack each recursion etas up obviously.
<hardcoding> Oh I think I had that problem when I tried to code the fibonnacci sequence!
<hardcoding> even though my code worked for small numbers, for 40, it would crash.
<mrvn> hardcoding: doubtfull. a non tail recursive fibonacci will never finish way before the stack overflows.
<hardcoding> Can you show me other examples of tail recursive functions ?
<mrvn> hardcoding: let fac x = let rec loop res = function 0 -> res | n -> loop (n * res) (n - 1) in loop 1 x
<hardcoding> why do I get -71303168 for fac(25)? (it works for all numbers before)
<hardcoding> (I mean why is the result negative for 25, it happened to me too with one of the fac functions I coded)
<mfp> hardcoding: integer overflow
<hardcoding> are stack or integers or any overflows due to the hardware or to the "software" ?
<hardcoding> integer*
<tsuyoshi> you can use Big_int to avoid overflow
<mfp> as for integer overflow, arguably both: the proc does 64/32 bit arithmetic, and OCaml reserves 1 bit for the GC (so you have 64/31-bit arith.)
<mfp> now, the sw. *could* detect overflows & cope with them, but OCaml's integer ops don't, for performance reasons
jeanbon has joined #ocaml
<s4tan> should be ocaml a managed language and then avoid such "feature" like integer overflow?
<tsuyoshi> let fac x = let rec loop res = function Big_int.zero_big_int -> res | n -> loop (Big_int.mult_big_int n res) (Big_int.sub_big_int n 1) in loop 1 x
_andre has joined #ocaml
<tsuyoshi> er
<mrvn> Hardly any language detects integer overflows.
<tsuyoshi> let fac x = let rec loop res = function Big_int.zero_big_int -> res | n -> loop (Big_int.mult_big_int n res) (Big_int.sub_big_int n 1) in loop Big_int.unit_big_int x
<mfp> IIRC Batteries has got some module that detects overflow, Safe_int or something
<mrvn> mfp: Doesn't that just switch to Big_int as needed?
<mrvn> And itisn't the language. That is a module that extends it.
<mfp> IIRC it raised an exception; if you want automatic promotion, there's Num
<tsuyoshi> oh that doesn't work.. ha
<mfp> "a module that extends" > since you can redefine (+) and friends, there's not much diff
<tsuyoshi> let fac x = let rec loop res = function n when n = Big_int.zero_big_int -> res | n -> loop (Big_int.mult_big_int n res) (Big_int.sub_big_int n 1) in loop Big_int.unit_big_int x
<tsuyoshi> can't pattern match on a variable...
<mfp> rlwrap ocamlfind batteries/ocaml
<mfp> # include Safe_int;;
<mfp> # fact 21;;
<mfp> Exception: Number.Overflow.
<mfp> actually fact 23
<tsuyoshi> how does it detect the overflow?
<mfp> inefficiently, by comparing the signs of the operands and the result, I guess?
<hardcoding> and the module Safe_int I can't find it
<s4tan> well there are machine tricks to detecet sucj overflow
<s4tan> *suck
<tsuyoshi> hrm.. it would be sort of fast if the compiler did it
<mfp> hardcoding: it comes from OCaml Batteries Included http://batteries.forge.ocamlcore.org/
<tsuyoshi> do a jmpo after every add in x86
<tsuyoshi> or jo
<tsuyoshi> pollutes the branch prediction cache though
<hardcoding> wow I'm looking at the codes on batteries, nice OCAML codes.
<mfp> haha it first does Pervasives.(*), then Nativeint.mul, if different -> overflow
<mfp> hardcoding: Batteries' build system comes from hell though ;)
<hardcoding> haha
ttamttam has left #ocaml []
<hardcoding> by the way, can anyone tell me why some people write their functions like that: let (name : type -> type) = function n etc..?
<flx_> hardcoding, that is very similar to the declaration in the .mli-file, so it's easy to copy'n paste
<flx_> also, sometimes it may be easier for the reader to see what the types of the parameters and return value are. of course, for that you could use let foo (a : int) : int -kind of definition.
<kaustuv> If you use this style, why even have a .mli?
<flx_> so you can have abstract types
<flx_> and so you can do separate compilation
<mrvn> I usualy name my arguments in a way the type is clear.
<kaustuv> Please tell me you don't use Hungarian notation
<mrvn> i,j,k,l,m,n are ints, s,str,buf are strings, f,g,h are functions
<hardcoding> so even if you use this style name : type -> type you still should have a .mli?
<flx_> I rather use names to indicate the meaning of the argument, not the type
<flx_> hardcoding, yes
<mrvn> hardcoding: you only need a mli when you want to hide something
<flx_> well, it depends
<flx_> if you have a small module and no need to hide, why bother
<mrvn> flx_: name is a string
<flx_> but perhaps when the module grows you might find that it's nice to have an mli around
<mrvn> flx_: then you can always just create one :)
<kaustuv> ocamlc -i module.ml > module.mli
<hardcoding> flx_, by names you mean : type points = int (* > 0 *) for example?
<flx_> hardcoding, yes
<mrvn> Too bad ocaml has no uint, uint32, uint64
<flx_> hardcoding, in the interface you could have plain "type points"
<flx_> and the user of that type would not know that it's an integer
<mrvn> type checksum = string. I want to hide that because maybe later I will use type checksum = int64.
<hardcoding> is it possible mrvn ?
<mrvn> hardcoding: totaly.
<hardcoding> I see.
<hardcoding> oh by the way does anyone know the command to get the OCAML compiler?
<mrvn> ocamlc or ocamlopt
<hardcoding> thanks
<hardcoding> ocaml-nox seems to have an ocaml compiler, is it good?
<hardcoding> wow 100MB^^
<hardcoding> hey when I type ocamlc help, they say -c compile only (don't link), what does link mean?
<mrvn> it creates the actualy executable
<hardcoding> and without link?? :s
<mrvn> In larger projects you first compile each module seperatly and then link them all together at the end.
<hardcoding> ok thank you
<mrvn> That way the next time you only have to compile the module(s) you edited so it is faster.
sporkmonger has joined #ocaml
<mrvn> Imho when you start to worry about -c then you should investigate writing a makefile for your project.
<mfp> anybody ever wished to disable inlining across .cmx files? (for faster separate compilation without inconsistent implementation assumptions)
<hardcoding> true, I probably won't need to create a makefile before a few weeks and maybe more.
<mrvn> mfp: what has inlining got to do with that? If the type changed then you need to recompile
<mfp> having to put the stuff you don't want inlined in a separate lib and hiding the .cmx is unconvenient
<flx_> mfp, does compiling speed matter, when you have byte code compiling? (where that is not an issue)
<mfp> mrvn: you also have to recompile if the type doesn't change
<mfp> flx_: what if you want both native code and faster (re)compilation?
<mrvn> mfp: hmm. The dependency detection handles all that for me so I never cared.
<mrvn> mfp: then you develope bytecode and make native when done
<flx_> mfp, well, then you take the ocaml compiler and hack it to your will.. ;)
<flx_> mfp, besides, you can't have both, if you're already dropping cross-module inlining ;)
<mfp> mrvn: I'm using OMake which handles deps fine, it's just that I'd want some stuff not to be rebuilt when the impl of some modules changes (but not the interface)
<mfp> flx_: "you can't have both"? ocamlopt already disables cross-module inlining if you hide the .cmx, it's just inconvenient
sporkmonger has quit []
<hardcoding> ok I have to go. Thank you all. Bye!
hardcoding has left #ocaml []
OChameau has joined #ocaml
det has quit [Read error: 131 (Connection reset by peer)]
det has joined #ocaml
<kaustuv> mfp: you can lower the inlining threshold (-inline) if you want superfast recompiling, but of course you lose intramodule inlining also
verte has joined #ocaml
<mfp> kaustuv: IIRC ocamlopt still inlines some stuff with -inline 0
<kaustuv> well, asmcomp/closure.ml line 761 is what you want to tweak if you want to hack the compiler
<kaustuv> (you can comment out the + List.length params, eg.)
<mfp> interesting, thanks for the pointer
<kaustuv> What does -inline -10000 do?
<mfp> does the trick :-)
<mfp> let f x y = x + y let g x y = f x y -> f inlined with -inline 0, not with -inline -10000
seafood_ has joined #ocaml
seafood has quit [Read error: 145 (Connection timed out)]
jeanbon has quit ["J'y trouve un goût d'pomme."]
filp has joined #ocaml
sporkmonger has joined #ocaml
_zack1 has joined #ocaml
_zack has quit [Read error: 104 (Connection reset by peer)]
seafood_ has quit []
bzzbzz has joined #ocaml
willb has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
Demitar has joined #ocaml
verte has quit ["http://coyotos.org/"]
Alpounet_ has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
willb has joined #ocaml
icebrain has joined #ocaml
Alpounet has quit [Nick collision from services.]
Alpounet_ is now known as Alpounet
thelema_ has quit [Remote closed the connection]
Alpounet_ has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
Alpounet has quit [Read error: 60 (Operation timed out)]
<flx_> leroy shows quite a lot of forethought in this answer on the topic of google summer code, esppecially in point 7 ;)
<Camarade_Tux> the "Harrop-style" also made me laugh ;)
Associat0r has joined #ocaml
<Alpounet_> yet another eternal "fight"
thelema_ has joined #ocaml
willb1 has joined #ocaml
Associat0r has quit []
icebrain has left #ocaml []
willb has quit [Read error: 110 (Connection timed out)]
willb1 is now known as willb
willb has quit ["Leaving"]
willb has joined #ocaml
filp has quit [Success]
thelema has quit [Read error: 110 (Connection timed out)]
ttamttam has joined #ocaml
s4tan has quit []
koppology has joined #ocaml
<koppology> hello
<koppology> just installed batteries
<koppology> whoo
<flx_> mrvn, btw, how's your filesystem going?
<thelema_> koppology: how do you like batteries?
<koppology> so far so good... i've been using a tiny extension i've co-written with some friends that we nicknamed sesame (for open sesame), this is a lot better though
<koppology> a lot more trying out to do, though
<thelema_> how did you install? godi? source?
<koppology> godi
<thelema_> no problems installing?
<flx_> wow, there exist clusters of ocaml users in the US?-)
<koppology> there are three of us :)
<thelema_> there's one in NY, it's called "jane street"
<flx_> let's rephrase that to 'ocaml hobbyists' then ;)
<koppology> one problem, which is that #man "the tutorial" or #man "for programmers" is failing from the toplevel
<koppology> "Sorry, I had a problem communicating with your browser and I couldn't open the manual"
_zack1 has quit ["Leaving."]
<Alpounet_> Do you think creating an OCaml User Group in Marseille would have success ?
<Alpounet_> :/
<hcarty> koppology: I think Batteries currently assumes some Debian and/or Gnome tools for finding the proper web browser for documentation
<hcarty> koppology: That may have changed in more recent versions though
<thelema_> I think the bits for documentation are... flaky, and have been worked on since the last release
<thelema_> I'd point you to the path on disk that the html docs are installed to, but I don't know what that is with godi.
<flx_> one of the most promising parts of the batteries project is that you guys take documentation seriously, even if it might require further improvement :)
<thelema_> flx_: we have yet to take documentation seriously. We'll have serious documentation when we have example usages for most of our functions
<flx_> thelema_, that will take some time
<flx_> but, off to home
<thelema_> for 100% coverage, yes. But it's a community project, and this kind of thing parallelizes well.
<thelema_> flx_: cheers
<koppology> thanks!
<Alpounet_> btw, don't hesitate to blog about Batteries, e.g
<thelema_> more important than wide usage of batteries (since it's still beta) is good testing - We've lots of bugs to squish.
<koppology> do you need to use use_batteries_r in _tags to get the language extensions?
<koppology> vs use_batteries
<thelema_> just use_batteries
<thelema_> everything else gets pulled in for free
<thelema_> s/for free/automatically/
<koppology> so what's the difference between batteries and batteries_r
<koppology> just out of curiosity
* thelema_ has to look that up - yoric authored that part of batteries.
<koppology> no worries
<thelema_> it looks like batteries_r is batteries w/ the revised syntax
jeanbon has joined #ocaml
ttamttam has left #ocaml []
<koppology> i am curious, also, i wrote a very short script that says
<koppology> open Util, Languages
<koppology> let _ = Printf.printf "%B\n" (Random.bool())
<koppology> but when i run it many times, it only prints "true"
<mrvn> you didn't randomize the random number generator.
<hcarty> koppology: It is probably using the same seed each run
<hcarty> Which means what mrvn said
<koppology> ah, got it
<koppology> need to use Random.init
gnuvince has joined #ocaml
gnuvince has left #ocaml []
hkBst has quit [Read error: 104 (Connection reset by peer)]
hkBst has joined #ocaml
itewsh has joined #ocaml
<thelema_> or Random.self_init ()
kaustuv_ has joined #ocaml
koppolog` has joined #ocaml
koppolog` is now known as koppology`
koppology` has quit [Client Quit]
kig has joined #ocaml
thelema has joined #ocaml
koppology has quit [Read error: 113 (No route to host)]
Snark has joined #ocaml
OChameau has quit ["Leaving"]
thelema has quit [Read error: 145 (Connection timed out)]
jlouis has quit [Read error: 104 (Connection reset by peer)]
itewsh has quit [Success]
gaPett has quit [Client Quit]
slash_ has joined #ocaml
itewsh has joined #ocaml
koppology has joined #ocaml
ttamttam has joined #ocaml
thelema_ has quit ["ChatZilla 0.9.84 [Firefox 3.0.7/2009021910]"]
jlouis has joined #ocaml
<Alpounet_> haha
<Alpounet_> Harrop answered.
<Camarade_Tux> although he left most of the points unanswered
<Alpounet_> that's just an usual "Harrop VS Leroy" fight
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
<jlouis> Alpounet_: link?
<Camarade_Tux> jlouis, it's on the mailing-list
<jlouis> Alpounet_: thankyou
<Alpounet_> Leroy & Harrop fight takes place after
<Alpounet_> but in this thread
ttamttam has left #ocaml []
<mfp> haha "Building a state-of-the-art optimized concurrent GC Leroy-style means an infinity-year project. =:-p"
<flx_> hey, could ocamlcore host a mailing list archive that had proper dates?-P
_andre has quit ["leaving"]
_zack has joined #ocaml
koppology has quit [Read error: 113 (No route to host)]
<Camarade_Tux> the mailing-list archives should also be accessible from some google site afaik
<Alpounet_> having everything concentrated on a single site (ocamlcore ?) would be great
<Alpounet_> like haskell.org for Haskell
<kaustuv_> I thought Leroy had a state of the art optimized concurrent GC sometime in the early nineties
thelema has joined #ocaml
<Camarade_Tux> you're probably refering to [18] on http://caml.inria.fr/about/papers.en.html
<kaustuv_> No, that paper is more about the proof of correctness. There was an experiment after OCaml fully forked from caml light where they tried to implement Doligez's thesis work, but it was abandoned because by the time they finished, the best multiprocessor system they had was slower than the next generation of uniprocessors.
<kaustuv_> And anyhow the conventional wisdom is apparently that CPU utilization asymptotically approaches around 400% no matter how many processors you add to the mix
koppology has joined #ocaml
koppology has quit [Remote closed the connection]
<mrvn> That is so dependent on the problem at hand.
<mrvn> For example weather calculations work real goot with millions of cpus.
mwhitney has quit [Read error: 145 (Connection timed out)]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
mwhitney has joined #ocaml
* Camarade_Tux hates the fact that "2.*.0.5" is 10% faster than "2./.2."
<hcarty> Camarade_Tux: In bytecode, native or both?
<kig> in assemblerrr
<Camarade_Tux> native
<Camarade_Tux> it doesn't happen in bytecode
<Camarade_Tux> but the speed difference doesn't surprise me, I was expecting it (that's why I tested that), I should really actually learn asm
<mrvn> Camarade_Tux: / is way more complicated than *.
slash_ has quit ["leaving"]
<Camarade_Tux> at first I expected that to be optimized by the processor (now I realize it would be even longer since it would require 2^-1)
<thelema> Camarade_Tux: the CPU should notice / 2 == * 0.5?
<thelema> you still need a division to invert the denominator
<kig> the compiler could do that (but is x / n == x * (1/n) true for all x and n?)
sporkmonger has quit [Read error: 110 (Connection timed out)]
<Camarade_Tux> thelema, exactly, it seemed natural but then I realized it was everything but trivial for a computer
<Alpounet_> good night
Alpounet_ has left #ocaml []
<thelema> kig: there's probably some floating point cases where it's not. mathematically it is.
<mrvn> tons
<mrvn> Try /. 3. and *. 0.33333333333
<gildor> flx_: what is the problem with date ?
<Camarade_Tux> gildor, the dates in the inria's archive are all NaN
itewsh has quit [Connection timed out]
<gildor> what INRIA archive has to do with ocamlcore mailing list date ?
itewsh has joined #ocaml
<thelema> mrvn: with sufficient precision on the 0.33333, and on the multiplication, they're the same.
thelema_ has joined #ocaml
<Camarade_Tux> gildor, *afaiu* flx_ thought about hosting an archive of the caml mailing-list
<mrvn> thelema: you would need more precision that the result has.
<thelema> mrvn: yes... and?
<mrvn> thelema: you only have floats
<thelema> so use an 80-bit 1/3 value to produce a 64-bit float result.
<mrvn> and do the multiplication in software?
koppology has joined #ocaml
<koppology> quick question, is PCRE ever going to be incorporated into batteries?
<thelema> kopp: it's on the todo list, but it's not high priority, because we're currently using unicode ropes as the high-powered string type, and PCRE won't work with it
<koppology> ok, sounds cool
<koppology> also, was wondering -- we've been using a fold_file type function
<koppology> kind of like List.fold_left
<koppology> is there an idiom in batteries for that
<thelema> across the lines of a file?
<koppology> yes
<thelema> there's a function to take a file and produce a [string enum] of its lines, and there's Enum.fold for folding across it.
<koppology> System.File.lines_of ?
<thelema> yup, that's it.
<koppology> great, thank you
<koppology> I take it you're one of the main developers, lema?
<mrvn> Does batteries have thesame fold and iter functions for lists and arrays?
kaustuv_ has quit [Remote closed the connection]
kaustuv_ has joined #ocaml
<koppology> by the way, I see that you often have chosen to have a fold function like so: fold f acc elem
<koppology> i mean, fold f elem acc
<koppology> rather than fold f acc elem
<koppology> where f is (elem -> acc -> acc)
<koppology> was that a conscious decision?
<mrvn> In the stdlib the order is different for _left and _right.
<koppology> yes
mwhitney has quit [Read error: 104 (Connection reset by peer)]
<mrvn> That fold sounds like fold_right.
<koppology> but in enum and in map, for example, it follows the fold_right convention I think
mwhitney has joined #ocaml
<thelema> koppology: yes, I'm heavily involved in batteries
<thelema> mrvn: batteries has filled in the gaps between lists and arrays' fold / iter
maskd has joined #ocaml
<thelema> koppology: the argument order probably came out of extlib (on which ocaml borrowed Enum's core)
<thelema> we had a recent commit that fixed the argument order of a bunch of our folds - it likely fixed this one to be more fold_left
<mrvn> That should really be standardized across all modules.
<koppology> I don't know which way is better really
<mrvn> and maybe always have fold_left and fold_right if you have a fold.
<koppology> it'd be nice to be consistent though
<koppology> I think it seems consistent on fold_right
itewsh has quit [Connection timed out]
<koppology> I guess I'm fine with that
<thelema> yes, enum.fold was fixed:
<thelema> -val fold : ('a -> 'b -> 'b) -> 'b -> 'a t -> 'b
<thelema> +val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
itewsh has joined #ocaml
<koppology> wait, so +val is what is currently in batteries?
<koppology> ok, i should just start compiling from the git repo, haha
<koppology> godi is slightly behind the times
koppology has quit [Remote closed the connection]
koppology has joined #ocaml
<thelema> we'll release beta1 soon. It would have been out this past weekend, but got delayed.
<koppology> that's exciting news
<mrvn> Package: libbatteries-ocaml-dev
<mrvn> Version: 0.20081112+gitBB342A7-1
<mrvn> Someone should update that then.
<mrvn> please
sporkmonger has joined #ocaml
<koppology> so, it still seems a bit strange to me to use an Enum as the intermediate datatype for folding over a file
<koppology> since Enums I believe are imperative, no?
rwmjones_ has joined #ocaml
<mrvn> Is that lazy or will it load the full file into ram?
<koppology> and that is my other concern
<koppology> seems kind of strange to load a whole file into memory, if that is indeed the case
<mrvn> If you have the ram then it is fast
<koppology> i'm going to try benchmarking it vs my fold_file
itewsh has quit [Remote closed the connection]
<thelema> kop: let us know how it goes. We do use bad char-by-char pulling of the file into strings.
<thelema> koppology: we could have an alternate implementation that did big block IO, and kept a buffer between calls, but it wouldn't mix with other read_foo functions
<thelema> If there was interest in fast line enums, it could be coded.
<mrvn> No buffered IO module in batteries?
<thelema> nope. Want to write one for us?
<mrvn> I have enough to work on libaio-ocaml.
<thelema> fair enough.
<mrvn> I'm thinking of adding some kine of printf/scanf like function but with more binary oriented formats. e.g. read/write 64bit int in little endian
<thelema> we're working on a more general printing infrastructure for batteries.
_zack has quit ["Leaving."]
Snark has quit ["Ex-Chat"]
jonafan has quit ["Leaving"]
willb has quit [Read error: 110 (Connection timed out)]
jonafan has joined #ocaml
Yoric[DT] has joined #ocaml
dj_ryan has joined #ocaml
jeddhaberstro has joined #ocaml
<koppology> i am getting kind of a weird error
<koppology> Wrong file naming: /Users/david/godi/lib/ocaml/pkg-lib/extlib/extlib.cmi
<koppology> contains the compiled interface for ExtLib
<koppology>
<thelema> did you install extlib with godi?
<thelema> can you remove it?
kaustuv_ has quit [Remote closed the connection]
kaustuv_ has joined #ocaml
<koppology> it's tricky, because it's a dependency for my library
* thelema wonders how hard let! would be to implement in ocaml
<thelema> koppology: can you base your library on batteries' extlib?
<koppology> let me try
<Yoric[DT]> thelema" what's [let!]?
<thelema> Yoric[DT]: an asynchronous binding construct - similar to lazy, but runs in its own thread and doesn't need any forcing - requesting thread blocks on trying to access the value
<Yoric[DT]> ok
<thelema> F# has recently added this (and some other high-level threading primitives)
<Yoric[DT]> Probably tricky to implement with reasonable performance.
<thelema> of course there'd be some overhead for using it... hmm, maybe explicit forcing is really needed to do it right... or some sort of scope that contains the async, requiring it to have a value outside that scope
<thelema> For high performance, yes, you'd want lower-level constructs. But if you just have to move at the speed of business... or a network...
<thelema> F# uses 'a async to capture the asyncness in a type... But I'm thinking it'd be possible to avoid forcing it (or maybe it's just best to make it really easy to force at the right time)
jeanbon has quit ["J'y trouve un goût d'pomme."]
mwhitney_ has joined #ocaml
mwhitney has quit [Read error: 104 (Connection reset by peer)]
<Yoric[DT]> The funny thing is that I'm working on something quite similar right now.
<Yoric[DT]> (futures, actually)
<Yoric[DT]> I'm just having difficulties encoding them in OCaml.