yangsx has quit [Read error: 110 (Connection timed out)]
Demitar has joined #ocaml
seafood_ has quit []
munga has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
schme has joined #ocaml
Yoric[DT] has joined #ocaml
TSC has quit [Read error: 104 (Connection reset by peer)]
<Yoric[DT]>
Does anyone know if there's a trivial way to add a dialog box with OCamlSDL ?
coucou747 has joined #ocaml
ikaros_ has quit [Remote closed the connection]
hsuh has joined #ocaml
schme has quit [Read error: 104 (Connection reset by peer)]
schme has joined #ocaml
LordMetroid has joined #ocaml
LordMetroid has quit [Client Quit]
LordMetroid has joined #ocaml
LordMetroid has left #ocaml []
jsk has quit ["Leaving."]
schme has quit [Remote closed the connection]
munga has quit ["Leaving"]
Yoric[DT] has quit ["Ex-Chat"]
ikaros has joined #ocaml
ikaros has quit [Remote closed the connection]
ikaros has joined #ocaml
ikaros has quit [Remote closed the connection]
ikaros has joined #ocaml
hsuh has quit [Remote closed the connection]
ygrek has quit [Remote closed the connection]
johnnowak has joined #ocaml
FZ has joined #ocaml
seafood_ has joined #ocaml
comglz has joined #ocaml
<flux>
afaik there isn't
<flux>
there are gui libraries for frame buffers, but I don't think any of them are for ocaml
seafood_ has quit []
TheLittlePrince has joined #ocaml
munga has joined #ocaml
munga has quit [Client Quit]
magnusth has joined #ocaml
RobertFischer has joined #ocaml
* RobertFischer
does a little dance for his first professional Ocaml project.
<Smerdyakov>
What is it?
<RobertFischer>
Working for Merjis -- doing some work with CocanWiki.
mwc has joined #ocaml
ygrek has joined #ocaml
<rwmjones>
really, jeremy employed you eh?
<rwmjones>
good luck, let me know if you have any cocanwiki code questions
<RobertFischer>
rwmjones: Yup, got off the phone with Jeremy not too long ago. And don't worry -- you'll be hearing from me. :) Is there a CocanWiki mailing list?
<sporkmonger>
is there any kind of naming convention in ocaml for functions that return a boolean value like ruby or scheme have? ie, "should_clone?" or "is_valid?"
<flux>
rwmjones, btw, you recently asked about how to write a module that wouldn't compile on 32-bit platforms.. does bitmatch require 64 bits?
<flux>
or the provided examples?
johnnowak has quit []
marmottine has joined #ocaml
jprieur has joined #ocaml
RobertFischer has joined #ocaml
<rwmjones>
flux, no
jlouis has joined #ocaml
* RobertFischer
has little faith in the library connection he's on. But he's sitting next to a waterfall in an indoor forest, so that's okay.
RobertFischer has left #ocaml []
RobertFischer has joined #ocaml
delamarche has joined #ocaml
OChameau has quit ["Leaving"]
ttt-- has quit [Read error: 110 (Connection timed out)]
<jonafan>
ocsigen?
<RobertFischer>
42.
<jonafan>
no way
<jonafan>
how do the haskell people model a cyclic graph?
<jlouis>
jonafan, maybe by the use of a clever zipper
<sporkmonger>
if i have an int option is there some way to actually get at the number and operate on it other than match?
<flux>
sporkmonger, yes, a function could retrieve the value and cause an exception if it's None
<flux>
sporkmonger, or perhaps you could use monads..
<sporkmonger>
i mean like
<sporkmonger>
if i've got let x = Some 2;;
<sporkmonger>
how would i add 2 to the thing inside x in order to get 4?
<sporkmonger>
aside from match x with
<Jedai>
sporkmonger: If you were in Haskell I would say fmap (+2)
<flux>
slightly different ;-) : match a, b with Some a, Some b -> a + b | _ -> failwith "hm, I expected Some, got None"
<flux>
oh, I misread what you said
<Jedai>
sporkmonger: But you could write a fmap for option in ocaml :
<flux>
anyway, the other option is to have a function let unopt = function Some v -> v | None -> assert false, or jedai's way
<Jedai>
fmap f Some(x) = Some(f x)
<Jedai>
fmap f None = None
<sporkmonger>
so there's always going to be some kind of pattern matching used to process variant types?
<Jedai>
Well, with proper OCaml syntax
<jlouis>
sporkmonger, x is a constant. You can't "add" something to it. You can match on it and then do something with the result though
<flux>
sporkmonger, what kind of other solution would you think there could be?
<Jedai>
fmap f = function | Some(x) -> Some(f x) | None -> None
<sporkmonger>
flux: i have no idea :-P
<sporkmonger>
that's why i'm asking
<Jedai>
And then you use fmap ((+) 2)
<sporkmonger>
interesting
<sporkmonger>
i'm mostly asking because i wrote this function, find_cloneable_transition which returns a State.t option and i wasn't quite sure how to get at my return value if it wasn't None
<sporkmonger>
but i guess the answer is match state with
<jlouis>
In Standard ML there is an Option.map function acting like the Haskell fmap (on option types only). Isn't there something akin in Ocaml?
bluestorm has joined #ocaml
<hcarty>
jlouis: I don't think that there is anything like that in the OCaml stdlib
<hcarty>
Developing an module for easier handling of option types was discussed briefly on the mailing list though
<jlouis>
hcarty, there is a score of function in the Standard ML basis one ought to steal
FZ has quit ["ChatZilla 0.9.81 [Firefox 2.0.0.13/2008031114]"]
<hcarty>
I don't use option very often. The mailing list discussion involved using exceptions vs Some/None
<sporkmonger>
what sub-section would the functions for int / float be in?
<hcarty>
sporkmonger: Pervasives most likely
<Jedai>
hcarty: Well option is not very convenient if you don't have good utility function to manipulate it, Haskell has those plus the Maybe Monad which is pretty useful to chain action that can fail without being explicit about it
<sporkmonger>
yup, there it is
<jlouis>
I tend to avoid option if at all possible
<hcarty>
sporkmonger: I was using something along the lines of floor (x +. 0.5) as a rounding function in some relatively recent code
<Jedai>
jlouis: It's pretty good documentation, it tells right in the type if an operation can fail, and it allows to handle the exceptional case easily
<sporkmonger>
yeah, still have to int_of_float that though :-(
<jlouis>
Jedai, that is monad speak ;)
<hcarty>
sporkmonger: Yes... replacing floor with int_of_float will give an int rather than float result
<jlouis>
For some code, the exceptional case is so damn rare that I don't want to bother with it at all
<Jedai>
jlouis: There's two responses to that : if the exceptional case is rare for all usage of the function you should use an exception rather than option and if the exceptional case if only rare for your code, you want an utility function : fromSome = function | Some(x) -> x | None -> failwith "I found None where Some is expected"
<hcarty>
sporkmonger: Will "let round x = int_of_float (x +. 0.5)" do what you need?
<sporkmonger>
yes
<sporkmonger>
which is what i did
<bluestorm>
there is an Option module in extlib
<bluestorm>
the provided functions are not that great, though
<bluestorm>
there is no monadic bind
<Anarchos>
bluestorm what is a monadic bind ?
Linktim has quit [Remote closed the connection]
<Jedai>
Anarchos: Monads are a datastructure and some functions on it that respect certain laws
<Jedai>
Anarchos: But the monad for Option is pretty simple :
<Anarchos>
Jedai which kind of laws ?
<Jedai>
bind o f = match o with | Some x -> f x | None -> None
<Jedai>
return x = Some(x)
<Jedai>
Anarchos: For example, the bind and return of a monad must be such that : bind (return x) f = f x
<Jedai>
bind m return = m
<Jedai>
bind (bind m f) g = bind m (fun x -> bind (f x) g)
<sporkmonger>
i have to parse some semi-complicated command line args in my program, and the Arg module looked like the right tool for the job, but uhm... i really don't understand the documentation... is there some example code that around somewhere i can take a look at that uses the Arg module?
<Jedai>
Anarchos: That may seems abstruse but for most natural monad those rules are evident (try it with the bind and return I defined for Option)
<Anarchos>
Jedai i see. Is there a good article on it ?
<Jedai>
Anarchos: This bind for option is interesting because it let's you chain call to function that may fail without explicitly matching the option
<Jedai>
Anarchos: You have plenty of Monad tutorial around (I first learned about them in my "Programming" course), they're are some for OCaml
<pango_>
"It starts with the reserved character '_'." seems to be a typo - keywords start with '-'
bluestorm has quit ["Konversation terminated!"]
Morphous has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
asymptote has joined #ocaml
<asymptote>
Is FFTW the best bet for an ocaml fft?
ikaros has quit [Remote closed the connection]
marmottine has quit ["Quitte"]
delamarche has quit []
Morphous_ has quit [Read error: 110 (Connection timed out)]
Axioplase has quit ["leaving"]
asymptote has quit ["Leaving"]
LordMetroid has joined #ocaml
kotarak has quit ["Xaide, leka nosht."]
filp has quit ["Bye"]
Tetsuo has quit ["Leaving"]
mwc has quit [Remote closed the connection]
seafood_ has joined #ocaml
delamarche has joined #ocaml
Demitar has joined #ocaml
psnively has joined #ocaml
hkBst has quit ["Konversation terminated!"]
delamarche has quit [Read error: 110 (Connection timed out)]
Oatmeat has joined #ocaml
<Oatmeat>
I'm creating a hashtable with Hashtbl.create and then storing a string key with a user-defined type value. When I try to add something to the hashtable I get the error "This expression has type user_type but is here used with type 'a. The type constructor user_type would escape its scope." Can anybody suggest how to fix this?
<Oatmeat>
I moved the user_type declaration above the Hashtbl.create and that fixed it
Oatmeat has quit []
seafood_ has quit []
psnively has quit []
jprieur has quit ["Connection reset by beer"]
jlouis has quit ["Leaving"]
yangsx has joined #ocaml
coucou747 has quit ["bye ca veut dire tchao en anglais"]