gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
arubin has joined #ocaml
ztfw has quit [Remote host closed the connection]
dnolen has joined #ocaml
pheredhel` has joined #ocaml
pheredhel has quit [Ping timeout: 264 seconds]
seafood has joined #ocaml
iratsu has quit [Read error: Operation timed out]
lopex has quit []
__mattam__ has quit [Ping timeout: 240 seconds]
mattam has joined #ocaml
iratsu has joined #ocaml
joewilliams is now known as joewilliams_away
junsuijin has joined #ocaml
seafood has quit [Quit: seafood]
sebz has joined #ocaml
dnolen has quit [Quit: dnolen]
jimmyrcom has quit [Ping timeout: 250 seconds]
joewilliams_away is now known as joewilliams
dnolen has joined #ocaml
iratsu has quit [Ping timeout: 250 seconds]
dnolen has quit [Quit: dnolen]
wagle has quit [Ping timeout: 240 seconds]
ulfdoz has joined #ocaml
StepanKuzmin has quit [Remote host closed the connection]
joewilliams is now known as joewilliams_away
seafood has joined #ocaml
wagle has joined #ocaml
wagle has quit [Remote host closed the connection]
wagle has joined #ocaml
ulfdoz has quit [Ping timeout: 240 seconds]
arubin has quit [Quit: arubin]
StepanKuzmin has joined #ocaml
slash_ has joined #ocaml
bobry has quit [Ping timeout: 258 seconds]
george_z0rwell has quit [Read error: Connection reset by peer]
Reaganomicon has joined #ocaml
edwin has joined #ocaml
junsuijin has quit [Quit: Leaving.]
<adrien> thelema: btw, I think that BatAvlTree.enum_f is dead code (unused in the module, not exported in the .mli file)
seafood has quit [Ping timeout: 240 seconds]
<adrien> also, Batteries is mixing spaces and tabs for the indentation ='(
bobry has joined #ocaml
ankit9 has quit [Quit: Leaving]
StepanKuzmin has quit [Read error: Connection reset by peer]
StepanKuzmin has joined #ocaml
larhat has joined #ocaml
betta_y_omega has quit [Ping timeout: 258 seconds]
betta_y_omega has joined #ocaml
slash_ has quit [Quit: leaving]
rby has joined #ocaml
ankit9 has joined #ocaml
rby has quit [Client Quit]
rby has joined #ocaml
Snark has joined #ocaml
slash_ has joined #ocaml
avsm has joined #ocaml
blinky- has joined #ocaml
slash_ has quit [Ping timeout: 240 seconds]
slash_ has joined #ocaml
slash_ has left #ocaml []
lopex has joined #ocaml
sepp2k has joined #ocaml
thomasga has joined #ocaml
darkf has quit [Quit: Leaving]
jimmyrcom has joined #ocaml
StepanKuzmin has quit [Read error: Connection reset by peer]
StepanKuzmin has joined #ocaml
_andre has joined #ocaml
itewsh has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 260 seconds]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
Modius has quit [Quit: "Object-oriented design" is an oxymoron]
mattam_ has joined #ocaml
StepanKuzmin has quit [Remote host closed the connection]
mattam_ has quit [Client Quit]
mattam_ has joined #ocaml
mattam_ has quit [Client Quit]
mattam_ has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
dnolen has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
avsm has quit [Client Quit]
avsm has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
<thomasga> is there some documentation on ocsigen 2.0 available somewhere ?
<raphael-p> thomasga: also http://ocsigen.org/eliom/dev/manual/ can prbly be of interest
<thomasga> thx!
_andre has quit [Quit: leaving]
julm has joined #ocaml
julm has left #ocaml []
_andre has joined #ocaml
<adrien> thelema: sorry to ask you direcly, in BatIMap, is there a way to get the range one point is a member of? say, if I store 42 in the 10..20 range, I'd like to recover "10" and "20" when giving "17"
<thelema> adrien: not at the moment.
<adrien> thelema: ok, or to know that 13 and 17 are in the same bin?
<thelema> You can/should create a modified get (maybe get_range) that does this
<flux> adrien, if you sure 10..15 and 16..20, would 15 give you 10..15 and 16 16..20?
<flux> (would->should)
<adrien> flux: yes, something like that
<flux> I guess batIMap is not for that, then?
<flux> maybe you can put the end points into the associated value?
<thelema> flux: no, that wouldn't work
<adrien> thelema: ok, at this point it's optimization so I'm not going to do it today but it's probably going to be done at some point during the week
<adrien> (that can save thousands of calls to Cairo)
<flux> thelema, well, you would need to post process the data to find if the range is still 'valid', but I guess it still problematic
<thelema> adrien: ok.
<thelema> flux: adding a single value to an imap can collapse two ranges that almost touch into a single range
<thelema> s/value/mapping/
<flux> oh, ok
<thelema> that single mapping doesn't have to be part of either range, just adjacent to both
sebz has quit [Quit: Computer has gone to sleep.]
avsm has quit [Quit: Leaving.]
sebz has joined #ocaml
<flux> there should be a custom range merging function?-)
<flux> unfortunately functors cannot have optional module parameters, so it's difficult to extend them..
dnolen has quit [Quit: dnolen]
avsm has joined #ocaml
<adrien> is there a function in the ocaml-shipped libraries to convert a float into milliseconds+seconds+minutes+hours?
<flux> I doubt that. should be a matter of some division?
<flux> (and modf)
<thelema> adrien: Unix.gmtime and Unix.localtime, except you'll have to deal with the fractions of a second
<flux> I was thinking he wanted that for intervals, not absolute time, but perhaps I was wrong?
<thelema> flux: as long as the interval is less than a month, gmtime will give the right answer, just ignore year, month, date
<flux> thelema, good idea :)
<flux> I guess it works nevertheles?
<flux> for those values
<thelema> for x < 86400
<thelema> probably still fine for x < 86400 * 31
<thelema> more than that - divide, remainder, divide, remainder, etc.
<flux> why would it break after a month?
<adrien> that's what I had thought of at first but it didn't give me the miliseconds, so I'm probably not blind and it doesn't exist, thanks :-)
<flux> or after any point in time, in fact
<flux> adrien, you can handle milliseconds separately with modf
<qdl> Hi, there. Since the syntax of this sprintf stiff is awful, I'd like to have a wrapper around it. I'd like to have aometinh like
<thelema> flux: it would be nontrivial to convert months + days + hours back to hours
<thelema> flux: days + hours is still prectical
<flux> thelema, ah, right
<flux> in any case, it's not a whole lot more difficult to divide etc :)
<qdl> float_to_string x n which should work like Printf.sprintf "%.nf" x
<thelema> qdl: let float_to_string x n = Printf.sprintf "%.*f" n x
eb4890 has joined #ocaml
<qdl> Writing something like Printf.sprintf "%.5f" 0.0012344 makes me assume sprintf could have type string -> float -> string
<qdl> Which isn't true.
<qdl> # Printf.sprintf;;
<qdl> - : ('a, unit, string) format -> 'a = <fun>
<flux> it's maaaagiiic
sebz has quit [Quit: Computer has gone to sleep.]
<thelema> qdl: printf format strings are magic; part of their type is the types and order of all following arguments
<flux> it's sort of interesting mechanism. somehow it knows the type of the function and then knows it can do special handling of the string argument.
<qdl> thelema: aha. I prefer proper type concepts. That's why i use OCaml and no nonsense language like C.
<flux> those kind of decisions are not seen anywhere else
<qdl> flux: Who or what is "it" in this context?
<flux> but tranformation itself I believe is implemented with CPS. in principle you can do it yourself, but not with as neat syntax.
<flux> qdl, the way it works
<flux> oh, and latter, the compiler
<qdl> Sounds a bit esoteric to me.
<flux> maybe it is. but I guess it's a nod towards C coders. printf is just so darn nice ;).
<flux> perhaps there's thinking like "we can do it too, but better!" (for some value of better)
<qdl> "The way it works decides this or that ..." blablblubb "magic" Don't try to understand it. Omar tazatt.
Boscop has joined #ocaml
<flux> there's a great white paper on how to do similar structures
<flux> was it called unparsing something?
<qdl> If this is nice, I don't wanna see ugly stuff.
<flux> :)
eb4890 has quit [Quit: Leaving]
<qdl> Thanks.
<qdl> What actually is "format"?
<flux> in that white paper it's a fictional function they want to have
<flux> ie. the moral equivalent of C's printf
sebz has joined #ocaml
<flux> (or perhaps sprintf)
<flux> or do you mean the type?
<flux> if you do, then perhaps you want to read that white paper, it might give you some insight what it might be
<qdl> Ah, no. Sorry. What is that format OCaml uses within this Printf module? It seems to be type constructor like list?
<flux> it is a type that encodes the format string. I guess that's all that can be said about it :).
<qdl> When I use sprintf within another function I have to write down an agurment of type "(something I don't remember) format".
<qdl> How are can arguments of this type be written? How is format defined?
<flux> I haven't looked. I'm thinking it's some CPS-style type, ie. it's a function type.
<flux> you can convert string literals into formats with format_of_string
<qdl> Is it somewhere in the documentation?
<flux> nope, it's an abstract type
<flux> but, you have the ocaml source code. it's there. try printf.ml
<flux> or perhaps pervasives.ml
<qdl> I've installed OCaml via fink. I dunno if the source is included there.
<qdl> OK, I've ocaml-3.11.1.tar.bz2 here.
<qdl> I'll take a look at it after reading that paper.
<qdl> Thanks so far.
<flux> good luck :)
<thelema> qdl: arguments of type format are written as literal strings. The connection between the type of a literal string and the format type it represents is in essence the meaning of that format string as a *printf argument
<qdl> Aha.
<adrien> also, is there a function to turn up to 4 bytes from a string into an int/Int32.t?
<flux> batteries has Int32.unpack(_big)
<adrien> so nothing in the standard library, and batteries' is pretty much like what I was doing with Char.code
<thelema> adrien: yup, that's the way to do it.
<flux> but if that's all you want from batteries, perhaps better go with let int32_of_string x = Int32.(of_int (Char.code x.[0]) + of_int (Char.code x.[1]) lsl 8 ..)
lopex has quit []
<adrien> flux: well, I had to copy BatIMap and BatAvlTree too ;-)
* adrien hates windows
<flux> adrien, slowly but surely you'll be porting batteries to compile nicely for windows ;)
<adrien> btw, I'm pretty pleased with BatIMap's performance :-)
<thelema> adrien: on my todo list is producing a windows executable for a program I've written for batteries. I'm stuck at getting findlib to install.
<adrien> flux: yeah, most probably ;-)
<adrien> thelema: findlib? iirc it wasn't a problem
<adrien> on the other hand, I've installed yypkg's dependencies with cp on windows
<thelema> adrien: to be honest, you should thank the author of camomile, yoriyuki, for writing IMap (and ISet)
<adrien> put them right next to the stdlib's .cm* files
<adrien> ah, it's him? on thing that I'm trying to avoid with Batteries on windows is actually camomile :P
<thelema> adrien: if that's all, use batteries v2 - it has no external dependencies
<adrien> thelema: do you remember how BatIMap works? and how the ?eq parameter is used?
<thelema> on findlib/win: "Fatal error: cannot load shared library dllunix ... cannot be found"
<thelema> adrien: yes, I use batIMap a lot. ~eq is for deciding whether two ranges can be merged
<adrien> thelema: that and the fact that I'll have to install one thing which means that 'cp' is _way_ easier for now unfortunately
<thelema> to merge (0,5,a) (6,10,b), one must be able to tell whether a and be are the same
<thelema> I've had the bad habit of using sets and other maps as the values in imap, so...
<thelema> I've needed my own comparison function to merge properly
<adrien> thelema: I've removed that in my application since I'm already doing it (I'm only appending), do you think that means I have to publish the changes? (they're really trivial)
<adrien> hahaha :-)
<adrien> strictly speaking, I have to, but these are _really_ trivial changes
<thelema> adrien: by the letter of the license, you'll have to publish the modifications to IMap.
<thelema> but I wouldn't worry about it.
<adrien> ok, thanks
<thelema> the person whose permission you should get is yoriyuki, though.
<adrien> yes, of course
<thelema> well, you'll have to make your modifications to IMap available to anyone who gets the resulting code.
<thelema> that doesn't mean full publication.
<adrien> getting licensing right is hard, and I'll have to mention which LGPL libraries are in use which is something I was about to forget
<thelema> just that they have the right to ask for the source.
<adrien> only modifications for LGPL? I thought it meant whole source
<thelema> I don't think LGPL requires attribution.
<thelema> I don't mean modifications like QPL, I mean you don't have to make your modified source any more pubilc than your executable that uses them
<adrien> *DIE* seamonkey, *DIE*
<adrien> ah, ok, as I thought then
<thelema> i.e. if you only use the code internal to a company, you don't have to share the brilliant improvements to imap
<adrien> no, I'll just put the whole sources along with it, I'm not going to try to do anything (now, the boss...)
<thelema> as much as it's nice to keep the sources with the executable, it's sufficient to make the sources available.
<adrien> I hope noone will ask for them thinking they'll discover terrific secrets when all I've done is assume eq always returns "false" (which meant some tests could be removed)
<thelema> ?? eq always returning false means no merging
<adrien> I hope that for them because it'd take more time to ask for the sources, get them, read them
<adrien> thelema: yes, I'm actually in a situation where there can be no merging because I'm only adding something once I know my data changes
<thelema> i.e. if you have the imap: (1,4,a) and add the binding (5,a), you have (1,4,a) (5,5,a) instead of (1,5,a)
<adrien> so I keep a counter and a value and add_range only when the value has to change
<thelema> I'll trust you know what you're doing.
<adrien> I'm adding in a linear fashion and that means I can delay the add until it is really needed (I get 5;5;5;5;8;8, so I remember that I'm currently at "5" and when I get to "8", I do the add)
<adrien> it was like that in the code before and it's going to require way less operations
<thelema> do you really need an interval map, then?
<thelema> ah, you still need the ability to query (5,7) for 6
<thelema> you might want to use a regular map and a funny compare function
<adrien> right, that would work too
<adrien> that also makes more sense :-)
<thelema> let compare (a,b) (c,d) = if b < c then 1 else if c > b then -1 else 0
<adrien> definitely thought of something too complicated ;-)
<adrien> also, http://answers.google.com/answers/threadview/id/439136.html "Q4: What are the complete requirements when distributing the application that uses the LGPL library?"
<adrien> that includes mentionning the library is in-used
<adrien> use*
<thelema> adrien: okay then. I guess you have to put a note in the docs.
larhat has quit [Quit: Leaving.]
<adrien> I should start doing that even for my GPL- and BSD-licensed stuff too
ankit9 has quit [Quit: Leaving]
bobry has quit [Quit: Leaving.]
Boscop has quit [Ping timeout: 250 seconds]
Boscop has joined #ocaml
Boscop has quit [Changing host]
Boscop has joined #ocaml
<thelema> map3d: 'a -> ('a -> 'a -> 'a -> 'b) -> 'a list -> 'a list -> 'a list -> 'b list
avsm has quit [Read error: Operation timed out]
<thelema> is there a more appropriate way to handle merging lists of uneven length? padding with default values seems ugly, but all the possible empty/non-empty cases for this function are also ugly
joewilliams_away is now known as joewilliams
<raphael-p> thelema: function could take a [`Pad | `Cut] argument…
<raphael-p> [`Pad | `Trunc] maybe
avsm has joined #ocaml
<thelema> raphael-p: [`Pad x | `Trunc] - but this still requires implementing the 2^n ways that x can replace a missing entry among n lists
<thelema> at some point, it's got to be more efficient to just pad the lists (i.e. 1000 lists merged = 2^1000 match cases = impossible)
<thelema> raphael-p: and ?pad would suffice for this
ikaros has joined #ocaml
bobry has joined #ocaml
ankit9 has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
itewsh has quit [Quit: o/]
<thelema> could I get some help proofreading some repetitive code: http://pastebin.com/vtpzSzp9
Anarchos has joined #ocaml
<thelema> the pattern match logic accepts it, but there's a bug right around it, and I want to make sure I've not made any stupid mistakes
<thelema> s/logic/compiler/
avsm has quit [Quit: Leaving.]
dahc has joined #ocaml
DimitryKakadu has joined #ocaml
kelaouchi has joined #ocaml
avsm has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
<flux> hm, so whenever one of the lists run out, acc is used in its place?
<flux> ah, no, but 'def'
<thelema> yes.
<flux> pretty nice idea of putting in a 'padding value' into the match clause
<flux> I wonder what kind of horrendous assembler that will produce :)
<thelema> yup, that allowed me to keep from having to produce tons more function calls
<thelema> flux: it *could* be quite efficient
<flux> looks ok to me
<flux> symmetry helps
<thelema> I wouldn't put it past xavier's perfectionism to optimize matching so that it turns out efficient
<flux> I actually wrote something with the assistance of compiler just yesterday or day before
<thelema> flux: thanks for looking over it - it's hard for me to proofread
kelaouchi has quit [Quit: Colloquy for iPhone - http://colloquy.mobi]
<flux> this, a work of beaty: http://pastebin.com/VMJGzyV3
<flux> (not)
<flux> but the magic begins at line 32 I think
<flux> I was very happy to have completeness checking :)
<raphael-p> thelema: looks ok (also aligning code on , and introducing empty lines makes it more readable IMHO)
<thelema> raphael-p: empty lines where?
<flux> (I wonder if the coding would be better off without the final parity of parity bit)
<raphael-p> thelema: http://pastebin.com/syxitD3i
<raphael-p> that's purely cosmetics, it's your code, write it as you like to read it
<thelema> raphael-p: thanks for the feedback
<flux> btw, for all you emacs-lovers, M-x align is great ;-). wouldn't quite do that, though.
<thelema> flux: List.filter ((=) true) xs == List.filter identity xs
<flux> wasn't quite sure if there was that function around
<thelema> (fun x -> x)
<raphael-p> flux: it's done with vim Align plugin (empty lines instered manually though)
<flux> I could've indeed used that :), but actually ((=) true) is shorter.
<flux> I was btw pretty happy with myself when I wrote that None, One, Many-counting, enabling to use the match exhaustiveness check :)
<thelema> you can skip List.length by doing | [] -> `None | [_] -> `One | _ -> `Many
<_habnabit> there's not a way to get backtraces in the toplevel without patching ocaml?
<_habnabit> some google searching just seems to turn up results with patches.
<flux> _habnabit, correct :/
<_habnabit> dang.
<flux> (hey, there are actual patches?, nice ;-) )
<_habnabit> # Edge_painting.of_refpkg rp;;
<_habnabit> Exception: Not_found.
<_habnabit> this kind of thing seems to happen to me often.
<_habnabit> and it's... rather uninformative.
<thelema> _habnabit: there's not really line numbers in the toplevel, so...
<_habnabit> sure, but I want to see where it was raised in the code I called.
<_habnabit> I didn't define this module or function; it's loaded from a cma or whatever.
<thelema> you may have to put your code in a file and compile it
<_habnabit> yeah, that's what I'm doing now.
smerz has joined #ocaml
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 276 seconds]
Boscop_ has joined #ocaml
Boscop has quit [Ping timeout: 260 seconds]
dahc has quit [Quit: Leaving]
betta_y_omega has quit [Ping timeout: 246 seconds]
Boscop_ has quit [Ping timeout: 264 seconds]
avsm has quit [Quit: Leaving.]
betta_y_omega has joined #ocaml
Boscop_ has joined #ocaml
lopex has joined #ocaml
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
explodus has joined #ocaml
avsm has joined #ocaml
Boscop__ has joined #ocaml
peddie has quit [Remote host closed the connection]
peddie has joined #ocaml
Pepe_ has quit [Ping timeout: 240 seconds]
krktz has quit [Ping timeout: 252 seconds]
taupin has quit [Ping timeout: 260 seconds]
Boscop_ has quit [Ping timeout: 258 seconds]
krktz has joined #ocaml
taupin has joined #ocaml
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
gno has quit [Disconnected by services]
Pepe_ has joined #ocaml
ulfdoz has joined #ocaml
_andre has quit [Quit: leaving]
Associat0r has joined #ocaml
Associat0r has quit [Changing host]
Associat0r has joined #ocaml
Boscop__ is now known as Boscop
bzzbzz has quit [Ping timeout: 260 seconds]
DimitryKakadu has quit [Quit: Konversation terminated!]
joewilliams is now known as joewilliams_away
joewilliams_away is now known as joewilliams
Snark has quit [Quit: Quitte]
sepp2k1 has quit [Quit: Leaving.]
lamawithonel has quit [Ping timeout: 260 seconds]
ulfdoz has quit [Ping timeout: 246 seconds]
edwin has quit [Remote host closed the connection]
Associat0r has quit [Quit: Associat0r]
blinky- has quit [Quit: /quat, deux doigts coupent faim]
Morphous has quit [Read error: Connection reset by peer]
ikaros has quit [Quit: Ex-Chat]
Morphous has joined #ocaml
joewilliams is now known as joewilliams_away
jamii has joined #ocaml
lamawithonel has joined #ocaml
sebz has joined #ocaml
avsm has quit [Quit: Leaving.]
metasyntax has quit [Quit: WeeChat [quit]]
penryu is now known as mozilla
mozilla is now known as penryu
smerz has quit [Read error: Connection reset by peer]
qdl has quit [Ping timeout: 252 seconds]
qdl has joined #ocaml
arubin has joined #ocaml