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
_zack has joined #ocaml
_zack has left #ocaml []
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
schme has quit ["leaving"]
<thelema> johnnowak: can you send me your camlzip makefile for installing with ocamlfind?
<thelema> I want to include it in batteries (or maybe a patch)
<johnnowak> thelema: i just added a META file in site-lib/camlzip and site-lib/zip that pointed to ../../zip
<johnnowak> probably the more sensible thing to do is just fix camlzip and include it with batteries
<thelema> really... hmm, that's probably better than my solution
<thelema> my solution involved modifying the makefile to install with ocamlfind
<johnnowak> that's probably better but i've no idea how to do it.. i'm not generally familiar with the ocaml build systems and such
<thelema> johnnowak: there's some disadvantages to including camlzip inside batteries
<thelema> fair enough. If you have any other comments on batteries, let me know so I can fix.
<johnnowak> thelema: perhaps the lack of testing the install instructions in the documentation is something that could be fixed :)
<johnnowak> i don't think the docs even mentioned camlzip
<thelema> the docs do mention camlzip
<thelema> install instructions seem to be avoided by the rest of the team, as they seem to think package managers fix this
<johnnowak> that's where i was looking
<johnnowak> camlzip isn't mentioned on that page
<johnnowak> godi failed to install batteries for me, which is why i tried the manual version
<johnnowak> it would also be nice if the homepage mentioned it doesn't work on 3.11 (as I think it doesn't)
<johnnowak> i wasted some time with that..
<thelema> sorry about that. It's in the README
* thelema finds and fixes that doc
<thelema> thanks for finding that.
<johnnowak> no problem. thanks for taking care of it.
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
Associat0r has quit []
chrisliaw has joined #ocaml
rwmjones has quit [Read error: 60 (Operation timed out)]
rwmjones has joined #ocaml
caligula_ has joined #ocaml
|jedai| has quit [kornbluth.freenode.net irc.freenode.net]
caligula has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
chrisliaw has quit [No route to host]
<tsuyoshi> hm.. the readme only says ia32 is supported with osx, but amd64 seems to work anyway
|jedai| has quit [Connection timed out]
|jedai| has joined #ocaml
|jedai| has quit [Read error: 60 (Operation timed out)]
|jedai| has joined #ocaml
<thelema> tsuyoshi: osx on an amd chip?
<tsuyoshi> yeah
<tsuyoshi> er no
<thelema> just 64-bit mode
<tsuyoshi> osx on an intel chip which supports amd64
<tsuyoshi> yeah
|jedai| has quit [Connection timed out]
|jedai| has joined #ocaml
Stefan_vK1 has joined #ocaml
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
Stefan_vK has quit [Read error: 110 (Connection timed out)]
ygrek has joined #ocaml
johnnowak has quit [Remote closed the connection]
seafood has quit []
Yoric[DT] has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
|jedai| has quit [Connection timed out]
|jedai| has joined #ocaml
_zack has joined #ocaml
ikaros has joined #ocaml
vixey has joined #ocaml
Camarade_Tux has joined #ocaml
m3ga has joined #ocaml
<flux> hm, nokia might switch qt to lgpl, so indeed it's not a bad timing if the qt bindings pop up, as this will possibly boost adoption: http://arstechnica.com/news.ars/post/20090114-nokia-qt-lgpl-switch-huge-win-for-cross-platform-development.html
m3ga has quit ["disappearing into the sunset"]
mishok13 has joined #ocaml
_zack has quit ["Leaving."]
<Camarade_Tux> iirc the project's eta for an alpha was something like months (8 or 11)
<flux> :(
<flux> I suppose (and hope?) most of their work goes into writing the conversion tools, not as much into writing glue code manually
<flux> as to be as automatically maintained as possible in the future
<Camarade_Tux> but qt is huuuuge
<flux> very little (that is: nothing) is told about what they expect or hope to have by the alpha release..
<flux> hmph, trac apparently doesn't have "browse changes" view
<Camarade_Tux> from my experience with automatic bindings generation, I think they'll have fast everything bound but with some types incorrect and probably no memory management
* Camarade_Tux hates trac
<flux> I don't see why these bindings would need to be bound by limitations posed by other, more generic, binding generators
<flux> because they are custom made.
<flux> and I imagine QT has some sort of centralized memory management concept
<flux> so objects and mechanisms dealing with MM should be easy to identify?
<flux> (disclaimer: I have 0 QT experience, barring possibly a hello world in c++ eons ago)
ikaros has quit [".quit"]
<mrvn> What do I throw when a malloc() fails?
ikaros has joined #ocaml
<sanguinev> mrvn: Failure of malloc should return a null pointer (I think).
<mrvn> the malloc is a part of a custom block I build.
<sanguinev> mrvn: Are you aiming to match the ISO C standard, or just do what you want with it?
<flux> mrvn, I imagine Failure would be the proper exception to throw
<mrvn> sanguinev: I want it not to segfault and something better than an assert in the C code.
<Camarade_Tux> flux, finding the proper ocaml type for everything qt gives is probably not that easy, moreover they need to design an api and as for the memory management, it's always nicer to have it done as much as possible by ocaml so that takes time too
<flux> camarade_tux, but once you figure out a Concept for doing MM with O'Caml & QT, it should pretty much automatically cover all the cases_
<flux> compared to building bindings to numerous different libraries, which might all have different ideas on how to do MM
_jedai_ has joined #ocaml
<sanguinev> mrvn: I guess I would go with flux and throw an exception if it failed then...
<mrvn> sanguinev: that is why I asked what to throw. :)
|jedai| has quit [Read error: 110 (Connection timed out)]
<Camarade_Tux> flux, the reason may simply be they are busy, the trac shows fast no activity for the last months
<mrvn> fast? nearly?
<Camarade_Tux> mrvn, yeah ;p
<Camarade_Tux> german overflow ;)
ygrek has quit [Remote closed the connection]
s4tan has joined #ocaml
Associat0r has joined #ocaml
_zack has joined #ocaml
ikaros has quit [".quit"]
Camarade_Tux has quit [""first time I'm not completely late ! \o/""]
CoryDambach has quit [Read error: 54 (Connection reset by peer)]
s4tan has quit [Read error: 110 (Connection timed out)]
_zack has quit ["Leaving."]
s4tan has joined #ocaml
_zack has joined #ocaml
_jedai_ has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
marmotine has joined #ocaml
OChameau has joined #ocaml
vpalle has joined #ocaml
Associat0r has quit []
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
s4tan has quit [Read error: 110 (Connection timed out)]
<kig> any ideas on [accurately] averaging a list of ints using a fold? (sum l / length l breaks when sum l > max_int)
|jedai| has quit [Connection timed out]
|jedai| has joined #ocaml
<vixey> if the average of the first 5 elements of a list is 3.2, and the next element of the list is 8
<vixey> the average of the first 6 elements of the list are: (5*3.2 + 8)/6
<det> kig, you need to sum/count using fold, then average using those
<kig> so use a float accumulator (and hope the accum error < 1)?
<det> use a float * int accumulator
<det> actually
<det> int * int
<vixey> (5*3.2 + 8)/6 = 5/6 * 3.2 + 8/6
<det> then convert both to floats and divide
<kig> so float * float :)
<det> better to accumulate as int, IMO
<det> let (sum, count) = List.fold_left <function> (0, 0) <list> in
<kig> there's a double equivalent to every 32-bit int, so it shouldn't matter all that much
<det> (float sum) /. (float count)
<det> incrementing an int by 1 is faster than incrementing a float by 1
<kig> it's one cycle, no?
<kig> hrr i'll check
<det> and also, your data is a sum of whole numbers, then you should use the appropriate type
<det> even dismissing performance concerns, it is more correct
|jedai| has quit [Read error: 60 (Operation timed out)]
|jedai| has joined #ocaml
seafood has joined #ocaml
<kig> here's a test case: average [max_int; max_int; max_int] = max_int
<kig> it doesn't work with the multiply running avg by idx, hmm
<kig> *fiddles*
<vixey> use bignums
<det> yeah, this algorithm falls down if the sum is too large
<mrvn> use floats.
<det> yeah, float was probably the best choice afterall :-)
<kig> avg*(idx / (idx + 1)) + (v / (idx + 1)) would not overflow, but still needs some sort of modulo magic to keep accuracy
<kig> s/not overflow/totally not work with ints, as idx / (idx+1) = 0
s4tan has joined #ocaml
<mrvn> kig: loose the ()
<mrvn> kig: Problem with that is that you need to know how many overflows the * causes to do the / right. And you get tons of rounding errors.
<kig> yes
cataska has quit ["leaving"]
<vixey> seems pretty trivial to solve using infinite precision arithmetic
<kig> yes, bignum would work
<vixey> ...but?
<mrvn> slower than float and overly accurate in most cases
<vixey> "overly accurate"???
<mrvn> You don't need to know that the average in 5.125333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333
<vixey> yeah because it's roughly 6
<mrvn> The first few digits usualy suffice.
<mrvn> i.e. 5.12 or so
<vixey> you can compute 5.12 from 5.125333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 very easily
<mrvn> but why track all that precision through the list if float is just fine?
seafood has quit []
<vixey> if float is fine then simply use float.
<vixey> I'm not sure what you mean about tracking all the precision by the way, I would build up a computation with fold, and run it to 3 decimal places at the end
<vixey> (this is probably not what bignum does)
<mrvn> vixey: the sum could get large
<kig> let num_sum l = List.fold_left (fun s i -> s +/ num_of_int i) (num_of_int 0) l;;
<vixey> bigger than what a float can hold?
<kig> let num_average l = int_of_num (num_sum l // num_of_int (List.length l));;
<mrvn> kig: some decimals would be nice though.
<mrvn> usualy
<kig> vixey: bigger than a float can accurately hold at least
<mrvn> Or just calculate the medium.
<mrvn> On 64bit cpus you can easily exceed a float.
<mrvn> But then the code wouldn't run on 32bit cpus with the same input.
<kig> the ocaml float is a double though
<mrvn> kig: which means 56bit accuracy iirc.
<mrvn> int has 62
<kig> yeah
<kig> oh right, yeah, i get what you meant
<kig> on 64-bit cpu, float is a double and int is a 64-bit int, on a 32-bit cpu, float is a double and int is a 32-bit int
<mrvn> But you have to prepare for int being 31 bits and then float can cope with lists of 32 million numbers.
<mrvn> An average of int64 list might be better with bignum
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
vixey has quit ["There exists an infinite set!"]
ygrek has joined #ocaml
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
marmotine has quit [kornbluth.freenode.net irc.freenode.net]
mjonsson has quit [kornbluth.freenode.net irc.freenode.net]
marmotine has joined #ocaml
mjonsson has joined #ocaml
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
s4tan has quit []
ygrek has quit [Remote closed the connection]
s4tan has joined #ocaml
^authentic has joined #ocaml
authentic has quit [Read error: 145 (Connection timed out)]
^authentic is now known as authentic
robocop has joined #ocaml
<robocop> Hello. Is there a function to return proper an error to the user ?
<robocop> a standard function.
|jedai| has quit [Connection timed out]
<mrvn> raise?
<thelema> robocop: many ocaml user like exceptions for that: raise Foo
|jedai| has joined #ocaml
<robocop> Yes, but, for show to the user what's the probem.
<mrvn> print_string, Printf.printf
<robocop> do you use print_string "impossible to ..."
<robocop> ?
<robocop> ok.
<flux> robocop, well, Printexc.to_string might help you
<flux> of course, any usability guy would say not to do that :)
<thelema> ah, for logging error messages. Printf.eprintf is what I use - it prints to stderr
<robocop> Yes, thanks thelema :).
<robocop> And thanks flux too.
<robocop> why we do not have the right to write this: try let map = get_map file in with _ -> Printf.eprintf "Unable to open the map: the file does not exist or is corrupted." ?
<rwmjones> robocop, failwith
<thelema> robocop: you need something after the [in], or you need to reverse your [try] and [let]
<thelema> let map = try get_map file with _ -> Printf.eprintf "..."
<thelema> in
<thelema> oops, type problem there
<robocop> bug get_map doesn't reverse the type unit.
<robocop> yes.
<robocop> *but
<thelema> what do you want it to return instead of the results?
<thelema> or do you want the program to quit?
<thelema> how do you want the program to continue after get_map fails?
<robocop> I want to write the error in the stderr or show the error, but, I dosn't use a console (SDL).
<robocop> Hum, to start, I use failwith, i thinks it's more easier.
<thelema> use failwith, catch the error somewhere, display it, and then quit
<thelema> or do whatever's appropriate at your toplevel
<robocop> Thanks for you answer.
ched has joined #ocaml
|jedai| has quit [Connection timed out]
|jedai| has joined #ocaml
<robocop> I've got an other problem. My main file of my program is http://paste.pocoo.org/show/99616/ . The function get_map (string -> tile array array) is in the file charge_map.ml and the type "tile" is in type.ml. For compile, I write "ocaml type.ml charge_map.ml main.ml"
<robocop> but the programme doesn't send any message...
<robocop> [quentin@quentin-desktop Jeux]$ ocaml types.ml charge_map.ml main.ml
<robocop> [quentin@quentin-desktop Jeux]$
<robocop> and not "ok".
<robocop> I've you got an idea ?
_zack has quit ["Leaving."]
vpalle has quit ["Leaving"]
dabd has joined #ocaml
vixey has joined #ocaml
<robocop> I'm going to rephrase my question: If I want to put all my type declarations in a file, How I can do ?
sporkmonger has quit []
robocop has left #ocaml []
robocop has joined #ocaml
Camarade_Tux has joined #ocaml
ikaros has joined #ocaml
<rwmjones> robocop, use a Makefile + ocamldep. Working out dependencies by hand is a waste of time.
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
Yoric[DT] has joined #ocaml
sporkmonger has joined #ocaml
<robocop> rwmjones: [quentin@quentin-desktop Jeux]$ ocamldep *.ml > .depend
<robocop> [quentin@quentin-desktop Jeux]$ cat .depend
<robocop> [quentin@quentin-desktop Jeux]$
<kig> anyone on 32-bit linux?
<rwmjones> that can be the case if no module uses the definitions in any other module
<rwmjones> kig, sometimes
<kig> rwmjones: re: prelude.ml tests, what do you reckon would be a good way to deal with netdate breaking in different ways on different platforms
<kig> 32-bit, what does this return: Netdate.format ~fmt:"%Y-%m-%d %H:%M:%S%z" (Netdate.create ~zone:0 (-.max_float))
<Yoric[DT]> kig: me
* rwmjones tries it
<rwmjones> yuck, NetworkManager--
<rwmjones> kig, sorry I got to reboot that machine
sporkmonger has quit [Connection reset by peer]
* Yoric[DT] is unfortunately working hard on something unrelated.
<rwmjones> kig:
<rwmjones> - : string = "0000-01-01 00:00:00+0000"
<kig> oh, right, that worked on i386 but not on ppc, sorry
<rwmjones> I don't have access to a ppc machine
<kig> here's the i386 one: Netdate.format ~fmt:"%Y-%m-%d %H:%M:%S%z" (Netdate.create ~zone:0 1e20)
<rwmjones> - : string = "0251-02-22 09:06:08+0000"
<kig> okay, thanks
<flux> oh, ocamlnet has that, nice to know :)
<kig> on x86_64 it gives Exception: Invalid_argument "Netdate.format_to".
willb has joined #ocaml
* kig comments out the failure probe tests for netdate, then the tests'll work the same across platforms
|jedai| has quit [Read error: 60 (Operation timed out)]
|jedai| has joined #ocaml
thelema_ has joined #ocaml
pango has quit [Remote closed the connection]
prime2 has joined #ocaml
pango has joined #ocaml
Snark has joined #ocaml
yziquel has joined #ocaml
Associat0r has joined #ocaml
yziquel has quit [Remote closed the connection]
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
_zack has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
ikaros has joined #ocaml
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
|jedai| has quit [Connection timed out]
|jedai| has joined #ocaml
s4tan has quit []
jdev has quit [Remote closed the connection]
thelema has quit [Nick collision from services.]
thelema_ is now known as thelema
thelema_ has joined #ocaml
|jedai| has quit [Success]
|jedai| has joined #ocaml
psnively has joined #ocaml
<Yoric[DT]> Mmmmhhhh.....
<Yoric[DT]> Is there a way to get something like this to work?
<Yoric[DT]> type ('a, 'b) liste =
<Yoric[DT]> Nil
<Yoric[DT]> | Cons of ('a * ('c, 'd) liste) constraint 'b = ( 'c * 'd )
<Yoric[DT]> (I mean, besides using polymorphic variants)
<Yoric[DT]> Ah, I can do something more simple, I believe.
<thelema> yor: why not just say [type ('a, ('c, 'd)) liste]?
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
<Yoric[DT]> thelema: because that's not possible, is it?
hdon has joined #ocaml
<thelema> you're right, only flat tuples of type variables
<jonafan> if anyone remembers the problem i was working on yesterday, i came up with a solution that's pretty cool
<thelema> jonafan: what's the solution?
<jonafan> it's a sort of decision tree
<jonafan> the problem was
<jonafan> you have a list of words
<jonafan> you guess a word and it tells you how many letters you have in the right place
<jonafan> you need to find the right word in 4 or fewer guesses
<thelema> given two words, the problem is to count how many letters are in the right place?
<thelema> how many letters match?
<jonafan> well that's not the problem
<jonafan> although you need to do that
<thelema> given one word and a list, it tells you how close you are to the closest word?
<jonafan> you want the word with the highest entropy because it tells you the most about the other words
<jonafan> you want one that shares a different number of letters with each other word if possible
<jonafan> if you guess a word that shares 1 letter with every other word, the fact that you got 1 letter right tells you almost nothing
<thelema> So you have a distance metric between your values, and your problem is to give shortest distance between guess and any member of list
<thelema> you're trying to guess all the words in the list, and the mechanism you have is this 'shortest distance' result, no?
<thelema> s/mechanism/feedback/
_zack has quit ["Leaving."]
petchema has joined #ocaml
ikaros has quit [".quit"]
dabd has quit ["Ex-Chat"]
ikaros has joined #ocaml
<jonafan> sorry i got distracted
<jonafan> but i think you've got it
<jonafan> i could post the solution
<jonafan> it's ocaml source code
<thelema> I imagine if your word list were big enough, it'd be worthwhile to generate a data structure such that you could search all the words at the same time
<thelema> but most likely, the simple pairwise check seems best to me.
psnively has left #ocaml []
<jonafan> yeah, it occurred to me that you could at least cache the result in a graph
<jonafan> but i couldn't think of anything more clever than that and that's not even that much better than doing it the stupid way
<thelema> a graph, like edges and vertices?
<jonafan> yeah
<thelema> how much did that gain you in efficiency?
<jonafan> oh, i didn't bother with it
<jonafan> the word list is generally only 20 words or so
jdev has joined #ocaml
robocop has quit [Remote closed the connection]
psnively_ has joined #ocaml
psnively_ has left #ocaml []
OChameau has quit ["Leaving"]
ikaros has quit [".quit"]
seafood has joined #ocaml
<Camarade_Tux> is there a way to see if a function is never used, much like the unused variable warning, but in a let ... = ... pattern, without the ending 'in'
<Camarade_Tux> ?
prime2 has quit ["leaving"]
<thelema> Camarade_Tux: without the ending "in", you're working at the toplevel, and there's no warning of non-usage because there's still the possibility of usage later. The scope is open.
seafood has quit []
<Camarade_Tux> that's what I feared
<Camarade_Tux> hmm, if my file is properly indented, :%s/^let/in let, should work :)
<Camarade_Tux> yep, worked and it found five unused functions :)
hdon has quit ["Leaving"]
thelema has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
oriba has joined #ocaml
thelema has joined #ocaml
jlouis has quit [Read error: 60 (Operation timed out)]
jlouis has joined #ocaml
Snark has quit ["Ex-Chat"]
vixey has quit [Remote closed the connection]
<Yoric[DT]> 'night everyone
<sanguinev> Adios
Yoric[DT] has quit ["Ex-Chat"]
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
schme has joined #ocaml
bla has joined #ocaml
Camarade_Tux has quit [""must sleeeeep""]
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
mib_61fy1v has joined #ocaml
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
mib_61fy1v has left #ocaml []
|jedai| has quit [Read error: 110 (Connection timed out)]
|jedai| has joined #ocaml
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
mohbana_ has joined #ocaml
<mohbana_> has anyone used ocaml on the jvm
schme has quit ["leaving"]
itewsh has joined #ocaml
oriba has left #ocaml []
<itewsh> hello
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
<itewsh> I'm wondering why the operators ((+) (-) (/) (*)) are not polymorphic ? (they could have this type: "'a -> 'a = <fun>")
<thelema> ite: because not all types can be added.
slash_ has joined #ocaml
<mrvn> Plus it would be kind of hard to infere ints.
<thelema> also because polymorphism interacts poorly with type inference
m3ga has joined #ocaml
<itewsh> hmm !
<itewsh> okay, I take that for granted
<mrvn> They could be sort of like a functor though. Having int, flost, int32, int64, bignum as arithmetic types.
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
psnively has joined #ocaml
psnively has quit [Client Quit]
marmotine has quit ["mv marmotine Laurie"]
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
schme has joined #ocaml
<thelema> pa_do will become part of batteries soon, allowing you to do: Big_int.( 23 ** 567 mod 45 + "123456789123456789123456789")
tomaw has joined #ocaml
Axioplase has joined #ocaml
tomaw___ has joined #ocaml
ched has quit ["Ex-Chat"]
yziquel has joined #ocaml
yziquel has quit [Remote closed the connection]
<mrvn> thelema: only with literals or how will that work with type inference?
tomaw___ has quit []
|jedai| has quit [Connection timed out]
|jedai| has joined #ocaml
itewsh has quit ["There are only 10 kinds of people: those who understand binary and those who don't"]
slash_ has quit [Client Quit]
acatout_ has joined #ocaml
Amorphous has quit [Read error: 110 (Connection timed out)]
Amorphous has joined #ocaml
acatout has quit [Read error: 110 (Connection timed out)]
yziquel has joined #ocaml
yziquel has left #ocaml []
yziquel has joined #ocaml
<yziquel> hi.
yziquel has left #ocaml []
|jedai| has quit [Connection timed out]
|jedai| has joined #ocaml
yziquel has joined #ocaml
yziquel has left #ocaml []
mohbana_ has left #ocaml []
yziquel has joined #ocaml