<bbdab> # Printf.printf ;;
<bbdab> - : ('a, out_channel, unit) format -> 'a = <fun>
<bbdab> I need some explanation here
<bbdab> I understand this would return 'a and it's a function.. not sure about the triplet, there
<exarkun> arg
* exarkun stumbles confusedly into walls.
<timmy> because the function can be partially applied i guess
<timmy> is there a function that takes like (f 5) => [0;1;2;3;4] or something?
<timmy> like range
<timmy> in other languages
* exarkun was just wondering that earlier today as well.
<exarkun> fwiw I didn't come across anything :)
<timmy> let range num =
<timmy> let rec range2 start stop list =
<timmy> if start=stop then list else range2 (start+1) stop (start::list)
<timmy> in
<timmy> List.rev (range2 0 (num-1) [])
* exarkun eeps.
<exarkun> How about: let rec range x = if x = 0 then [] else range (x - 1) @ [x];;
<exarkun> oh, unless you need that pesky start and stop stuff
<exarkun> :)
<timmy> well yours looks better definatelsy
<timmy> is @ left-assoc?
<exarkun> hmm
<timmy> i think i just like having mine tail recursive
<exarkun> yea, tail recursion is good
<timmy> even though i wouldn't see a speed difference
<exarkun> maybe if you have hugely massive ranges :)
<exarkun> do you know the syntax for default arguments? I seem to have forgotten it
<timmy> hmm
<timmy> i never knew it
* exarkun pops open the manual.
<exarkun> ahhh
<exarkun> ?(var = value)
<timmy> yeah just found it
<timmy> looks like it has to be a label
<exarkun> yea
<exarkun> I thought "let rec range ?(low = 0) high ?(step = 1)" would be a nice signature, but apparently that's not allowed
<timmy> well maybe if you put step first
<timmy> it would be allowed but maybe not as nice
* exarkun nods.
<exarkun> let rec range ?(step = 1) ?(low = 0) high =
<exarkun> if (low + step) >= high then
<exarkun> low :: []
<exarkun> else
<exarkun> low :: (range ~low:(low + step) ~step:step high);;
<exarkun> hooray, and such
* exarkun saves range.ml.
<exarkun> maybe that should be > instead of >= tho
<timmy> have you ever used lablgtk
<exarkun> never in ocaml
skylan has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
smkl has quit [Read error: 110 (Connection timed out)]
smkl has joined #ocaml
gl has quit [Read error: 113 (No route to host)]
gl has joined #ocaml
skylan has quit [carter.openprojects.net irc.openprojects.net]
scipient has quit [carter.openprojects.net irc.openprojects.net]
timmy has quit [carter.openprojects.net irc.openprojects.net]
Dybbuk has quit [carter.openprojects.net irc.openprojects.net]
themus has quit [carter.openprojects.net irc.openprojects.net]
exarkun has quit [carter.openprojects.net irc.openprojects.net]
bbdab has quit [carter.openprojects.net irc.openprojects.net]
Dieb has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
exarkun has joined #ocaml
Dybbuk has joined #ocaml
themus has joined #ocaml
bbdab has joined #ocaml
Dieb has joined #ocaml
scipient has joined #ocaml
timmy has joined #ocaml
skylan has quit [carter.openprojects.net irc.openprojects.net]
timmy has quit [carter.openprojects.net irc.openprojects.net]
scipient has quit [carter.openprojects.net irc.openprojects.net]
themus has quit [carter.openprojects.net irc.openprojects.net]
Dybbuk has quit [carter.openprojects.net irc.openprojects.net]
Dieb has quit [carter.openprojects.net irc.openprojects.net]
bbdab has quit [carter.openprojects.net irc.openprojects.net]
exarkun has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
exarkun has joined #ocaml
Dybbuk has joined #ocaml
timmy has joined #ocaml
scipient has joined #ocaml
themus has joined #ocaml
Dieb has joined #ocaml
bbdab has joined #ocaml
skylan has quit [carter.openprojects.net irc.openprojects.net]
timmy has quit [carter.openprojects.net irc.openprojects.net]
scipient has quit [carter.openprojects.net irc.openprojects.net]
Dybbuk has quit [carter.openprojects.net irc.openprojects.net]
themus has quit [carter.openprojects.net irc.openprojects.net]
bbdab has quit [carter.openprojects.net irc.openprojects.net]
exarkun has quit [carter.openprojects.net irc.openprojects.net]
Dieb has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
exarkun has joined #ocaml
Dybbuk has joined #ocaml
timmy has joined #ocaml
scipient has joined #ocaml
themus has joined #ocaml
bbdab has joined #ocaml
Dieb has joined #ocaml
timmy has quit [carter.openprojects.net irc.openprojects.net]
scipient has quit [carter.openprojects.net irc.openprojects.net]
scipient has joined #ocaml
timmy has joined #ocaml
skylan has quit [carter.openprojects.net irc.openprojects.net]
skylan has joined #ocaml
themus has quit [carter.openprojects.net irc.openprojects.net]
Dybbuk has quit [carter.openprojects.net irc.openprojects.net]
Dybbuk has joined #ocaml
themus has joined #ocaml
taw has joined #ocaml
<taw> hello
<taw> if I have "type t={x:foo; y:bar}" and i want to make funcion that operates on t with patter mathes depending on field x
<taw> let f = function VALUE_OF_X1 -> pat1 | VALUE_OF_X2 -> pat2 | etc. ;;
<taw> think that function is of foo not t
<taw> (well, it's right ;))
<taw> how can i do such function ?
<taw> aa
<taw> it works
<taw> no bother ;)
<taw> bye
taw has left #ocaml []
gl has quit [Remote closed the connection]
gl has joined #ocaml
Dalroth has joined #ocaml
<Dalroth> ok, I'm sure you guys get this question all the time, but what's the best OCaml book (I have haskell experience) for a english speaking OCaml newb? (I want a printed book, not online one)
<smkl> there are no printed books for ocaml in english
<Dalroth> that's what I thought
<Dalroth> makes reading on the way to work difficult :)
<smkl> there is a book for caml light, but i'm not sure if it's useful because you already know fp
<Dalroth> yeah, I need the hard core upper level stuff, thebasic stuff is easy, that I could learn by sitting at the computer
<Dalroth> it's just, I can't sit at teh computer and read for any length of time, I need to be sitting on the couch or outside or anything BUT at the computer :)
<Dalroth> how are OCaml's XML libraries? I'm getting frustrated with XSL's limitations, so what I'm REALLY doing is looking for a good FP language to replace XSL with. Haskell's XML is funky and I don't feel like writing my own parser, and I've never been a big fan on Lisp notation but will probably suck it up and do it if I have to (anything has to be better than xsl)
<smkl> pxp should be quite complete. i'm not sure if it's very easy to use
<Dalroth> well, it's hard to be any worse than the DOM :)
shen has joined #ocaml
shen has left #ocaml []
<exarkun> Arg, I still can't get this
<Dybbuk> What's up?
<exarkun> My bits won't go where I want 'em
<exarkun> it's supposed to take an Int64 and make it into a Num
<exarkun> A seemingly simple task :)
<Dybbuk> Dude, I am really not sure that OCaml is the best language to be doing bit-wise operations in.
<Dybbuk> Heh. :)
<Dybbuk> I think Nums are 30 bits. Are you taking that into consideration?
<exarkun> Heh, probably not :) I'm trying to implement a communication protocol, though, which means sending and receiving floats in ieee754 format, so...
<Dybbuk> Wowsa.
<Dybbuk> Hmmm.
<exarkun> Oh, blah.. that might be it.. I thought it would use Big_int for some reason
<Dybbuk> You might want to check out the Marshall module. It might give you some ideas.
<exarkun> now that you've said that I have _no_ idea why i thought that though
<exarkun> Eh, I checked out the marshal module, it looked pretty useless :) it looks like it does all the interesting stuff with external functions
<exarkun> this is for interoperation with other languages too though. The protocol is set, I just need to implement it :)
<Dybbuk> Ok, well, it might be that you have to use some C functions to put things together in the end.
<Dybbuk> High level languages are supposed to abstract the hardware representation of values...you shouldn't have to worry about them.
<exarkun> nod.. I'd like to avoid that, but I'll keep it in mind
* exarkun nods.
<Dybbuk> And then, you'll have your high-endian/low-endian problem there, too, I think.
<exarkun> yea, I'll worry about that a little later :)
<Dybbuk> Heheh. :)
<Dybbuk> I think you might want to do a little digging into the Ocaml source if you want a better idea of how floats and ints are stored internally.
<Dybbuk> Also, you might want to check out cryptgs. There's a bunch of funky Ocaml bit math going on in there.
<exarkun> cool, I'll check that out
<Dybbuk> I think that's what it's called...if you check the Caml Humps page you'll see it under cryptography.
<smkl> nums use big ints when needed
<smkl> current bug is let second = add_big_int big (power_big_int_positive_int b_mid (1 lsl 4))
<exarkun> that doesn't shift b_mid back 4 bits?
<exarkun> poh
<exarkun> doh
scipient has quit [Connection timed out]
gl has quit [Read error: 113 (No route to host)]
gl has joined #ocaml
mike_ has joined #ocaml
Miwong has joined #ocaml
<Miwong> hello
<Dybbuk> Howdy.
<Miwong> hey, Dybbuk
scipient has joined #ocaml
Dybbuk has quit [Remote closed the connection]
Miwong has quit ["."]
timmy has quit [Remote closed the connection]
timmy has joined #ocaml
gl is now known as gehel
gehel is now known as gl
Dybbuk has joined #ocaml
exarkun has quit ["Confidence is the feeling you have before you understand the situation."]
Dalroth has quit []
skylan has quit [Read error: 104 (Connection reset by peer)]
skylan has joined #ocaml
* gl is away: zzz