pikachuyann has quit [Quit: good night / bonne nuit]
avsm has quit [Quit: Leaving.]
wuj has quit [Ping timeout: 265 seconds]
joewilliams is now known as joewilliams_away
drunK has quit [Remote host closed the connection]
LionMadeOfLions has quit [Ping timeout: 252 seconds]
Amorphous has quit [Ping timeout: 245 seconds]
Edward__ has quit []
Amorphous has joined #ocaml
Edward_ has joined #ocaml
Edward_ has quit []
dsturnbull has joined #ocaml
philtor has joined #ocaml
m3ga has joined #ocaml
<m3ga>
in haskell, a constructor like Just (same as Some in ocaml) is a function 'a -> Maybe a'. is there a way to make constructors in ocaml work like functions? eg, i'd like to do 'let f = Some' so that in the interface file it would be 'val f : a -> a option'
<m3ga>
cluestick anyone?
dcolish has left #ocaml []
explodus has quit [Read error: Operation timed out]
explodus has joined #ocaml
<orbitz>
m3ga: fun x -> Some x
<orbitz>
m3ga: constructors were purposly designed to not be functions for clarity
<m3ga>
ah, thanks orbitz. that should allow me to remove a bunch of boilerplate
rks has quit [Quit: dodo]
LionMadeOfLions has joined #ocaml
valross has joined #ocaml
itegebo has joined #ocaml
itegebo has quit [Remote host closed the connection]
valross has quit [Remote host closed the connection]
valross has joined #ocaml
valross has quit [Ping timeout: 252 seconds]
valross has joined #ocaml
valross has quit [Client Quit]
valross has joined #ocaml
joewilliams_away is now known as joewilliams
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 240 seconds]
metasyntax has quit [Ping timeout: 276 seconds]
metasyntax has joined #ocaml
f[x] has quit [Ping timeout: 255 seconds]
f[x] has joined #ocaml
thieusoai has quit [Ping timeout: 265 seconds]
ulfdoz has joined #ocaml
thieusoai has joined #ocaml
m3ga has quit [Quit: disappearing into the sunset]
LionMadeOfLions has quit [Read error: Operation timed out]
ulfdoz has quit [Read error: Operation timed out]
ygrek has joined #ocaml
Yoric has joined #ocaml
joewilliams is now known as joewilliams_away
philtor has quit [Ping timeout: 240 seconds]
Snark has joined #ocaml
patronus has quit [Quit: leaving]
patronus has joined #ocaml
patronus has quit [Quit: leaving]
seafood has joined #ocaml
patronus has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
ttamttam has joined #ocaml
larhat has joined #ocaml
ftrvxmtrx has joined #ocaml
seafood has quit [Quit: seafood]
Yoric has quit [Quit: Yoric]
LionMadeOfLions has joined #ocaml
th5 has joined #ocaml
pikachuyann has joined #ocaml
yezariaely has joined #ocaml
<yezariaely>
I want to add a hashtable into a record. But how do I specify the type?
<yezariaely>
type my_record = {functions : (string, int) t};;
<yezariaely>
does not work: Unbound type constructor t
<mfp>
functions : (string, int) Hashtbl.t;
<yezariaely>
mfp: thx :)
_andre has joined #ocaml
pikachuyann has quit [Quit: Quitte]
boscop has joined #ocaml
boscop_ has quit [Ping timeout: 252 seconds]
pikachuyann has joined #ocaml
ikaros has joined #ocaml
valross has quit [Quit: Ex-Chat]
Yoric has joined #ocaml
<adrien>
I'm using lwt, lablgtk and react but React isn't thread-safe and lablgtk signals might be fired up while in the react update loop which is a big no, anyone know if there's already something to handle that (delay the gtk signals until the react update is done)?
<adrien>
I'm using lwt threading for lablgtk btw
<adrien>
I can delay them by hand but it'd be even better if all the work had already been done in a nice and safe way :P
seafood has joined #ocaml
ygrek has joined #ocaml
pikachuyann is now known as pikachuyann|afk
ygrek has quit [Ping timeout: 245 seconds]
joko has joined #ocaml
LionMadeOfLions has quit [Ping timeout: 276 seconds]
ccasin has joined #ocaml
ygrek has joined #ocaml
seafood has quit [Quit: seafood]
<joko>
Hello, I'm trying to create a function which converts a list to a map whose keys are the elements from the list. Any hints on what to do? I've tried with List.map and List.iter, but I had trouble..
<f[x]>
List.iter with Map.t ref or List.fold
philtor has joined #ocaml
yezariaely has quit [Quit: Leaving.]
<joko>
f[x]: thank you very much! I've managed to do it with List.fold. Perhaps could you explain the "Map.t ref" part?
<f[x]>
use ref to store accumulator and update it at each iter step
<joko>
f[x]: nice! Wasn't aware of references in OCaml... Is it common to use them?
<f[x]>
quite common
<pikachuyann|afk>
heu, eh bien, euh, bon, à vendredi soir ou samedi aprem - err, well, err... see you friday evening or saturday afternoon
npouillard has quit [*.net *.split]
cthuluh has quit [*.net *.split]
asmanur_ has quit [*.net *.split]
Axioplase_ has quit [*.net *.split]
pikachuyann|afk has quit [Quit: plouf. et c'était le dernier, à vendredi. - and that's the last one, see you friday...]
joewilliams_away is now known as joewilliams
<hcarty>
adrien: Does Lwt's React wrapper handle this?
<hcarty>
I haven't used it, but that may be part of why it's provided
<adrien>
hcarty: afaict, no, it doesn't: what it seems to provide is a way to run cooperatively the computations as in "React.E.fold (fun a b -> ...) a0 bl": the anonymous function would run cooperatively each time
<hcarty>
adrien: Ah, ok. Sorry for the noise then :-)
<adrien>
however, it might be quite easy: instead of calling React's "send" function, you would get a mutex, call the send function and release the mutex: "get_mutex (); send foo; release_mutex ()" and you wouldn't have to carry around the mutex and make sure it's only released when all computations made by react are finished
<adrien>
(I don't know if I made sense :-) )
<hcarty>
It does
<hcarty>
I think!
npouillard has joined #ocaml
cthuluh has joined #ocaml
asmanur_ has joined #ocaml
Axioplase_ has joined #ocaml
<adrien>
I'm still slowly writing the corresponding code, haven't settled everything yet (someone said "procrastinating"? =) )
<adrien>
(actually, I've written the code but I'm trying to get rid of a bug :-) )
<joko>
and adrien: fun1 is sort enough for you now? :)
<adrien>
;p
<joko>
short * :)
<adrien>
joko: you could use partial application: "List.fold_left (fun1 10) [] int_list"
<joko>
adrien: Thanks a lot!!!
<adrien>
it's equivalent to (fun a b -> fun1 10 a b)
LionMadeOfLions has joined #ocaml
y-fujii has quit [Quit: Leaving]
joewilliams is now known as joewilliams_away
avsm has joined #ocaml
joewilliams_away is now known as joewilliams
ftrvxmtrx has quit [Quit: Leaving]
th5 has quit [Quit: th5]
larhat has quit [Quit: Leaving.]
rks has joined #ocaml
bzzbzz has quit [Ping timeout: 264 seconds]
<joko>
Hm, I'm writing the mli and I want to express a map structure I'm using. "module IntMap : Map.S with type key = int" doesn't seem to work, any help?
<thelema>
do you want to express the type of IntMap or a value of type IntMap
<joko>
thelema: the type of IntMap
<thelema>
module type IntMap : ...
<joko>
Maybe define is a proper word in my question
<thelema>
and you'll have to define it in your .ml too
<thelema>
same syntax in both
<joko>
thelema: I'm using this http://ocaml.pastebin.com/mSvK7Htm in my .ml file (Map.Make) . I thought I was supposed to define it with a signature (Map.S)
<thelema>
you don't have to
<thelema>
if you're building a bigger project, you can use the .mli to hold interface comments and to restrict what gets exported from the module
<thelema>
what specifically is the error with your original .mli?
<joko>
I see what you mean, but later on on my .mli file I use this IntMap
<thelema>
(Something like that should be correct)
<thelema>
you use Intmap how? referring to IntMap.key?
<joko>
it says: "Error: Unbound type constructor"
<joko>
I use it on another definition, e.g. "val f1 : int IntMap.t -> int"
<thelema>
that error on the module declaration?
<joko>
Yes
<thelema>
can you paste more .mli - what you're doind should work...
<joko>
thelema: My bad, the error was from the .ml file... >_<
<joko>
I've fixed it, thanks for your help
avsm has quit [Quit: Leaving.]
init1 has joined #ocaml
<thelema>
n/p
ftrvxmtrx has joined #ocaml
ski has joined #ocaml
ygrek has quit [Ping timeout: 245 seconds]
ftrvxmtrx has quit [Quit: Leaving]
ttamttam has quit [Remote host closed the connection]
yezariaely has quit [Quit: Leaving.]
ftrvxmtrx has joined #ocaml
ccasin has quit [Quit: Leaving]
bzzbzz has joined #ocaml
philtor has quit [Ping timeout: 252 seconds]
Yoric has quit [Quit: Yoric]
LionMadeOfLions has quit [Ping timeout: 252 seconds]
thieusoai has quit [Quit: Leaving]
Snark has quit [Quit: Ex-Chat]
Yoric has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
ftrvxmtrx has joined #ocaml
Smerdyakov has joined #ocaml
drunK has joined #ocaml
_andre has quit [Quit: Lost terminal]
julm has quit [Quit: leaving]
julm has joined #ocaml
dark has joined #ocaml
<dark>
M-x camldebug, at emacs, says Symbol's value as variable is void: caml-mode-map
<dark>
I was trying to run it outside emacs, and set a breakpoint. I want to go up the call stack, but my program is just exitting..
<dark>
then I went to the manual and it advised me to run inside emacs..
devinus_ has joined #ocaml
<devinus_>
can ocaml not handle large precision floats?
<hcarty>
devinus_: Large precision?
<devinus_>
uhm
<dark>
you mean, double?
<devinus_>
as in
<dark>
I think ocaml's floats are actually doubles
<hcarty>
dark: They are
<devinus_>
99.99999999999999999999999 => 100 :(
<dark>
?..
<dark>
do you understand how floating point works?
<hcarty>
devinus_: There are arbitrary precision number modules around
<dark>
there's module Rational for arbitrary precision rationals (which aren't floating point numbers)
<devinus_>
dark: i understand how floatiing point works, they cannot hold everything, i was just wondering if ocaml had libraries or a way to abstract that away from me
<Smerdyakov>
In the future, talk about rationals or reals, not floats, if you don't actually want floats.
<devinus_>
yes
<dark>
if you are using serious numeric methods you _can't_ have this abstracted away, since your algorithm depends on its tendency to not accumulate errors (i.e. you choose your algorithm based on FP characteristics)
Smerdyakov has quit [Quit: Leaving]
devinus_ has left #ocaml []
<dark>
the syntax Module.(..) works out of box with 3.12
<hcarty>
dark: True, but pa-do adds some other magic
<hcarty>
dark: That said, having Module.( ... ) built in to the language now is a wonderful thing
LionMadeOfLions has joined #ocaml
<dark>
yeah, but this should not be necessary in this example. this part of ocaml (handling of numeric code) feels kind of broken by design :( (specially because other FP languages solved it by another way)
<hcarty>
dark: How is it broken when compared with other languageS?
<hcarty>
Oops, languages rather
<dark>
I'm comparing with haskell
<hcarty>
How is it broken when compared with Haskell? (I'm only slightly familiar with Hashell)
<hcarty>
Haskell... It's typo time.
<dark>
haskell has a system where you can, for each type variable, attach to it a predicate, saying it has some characteristic
<dark>
it's called a type class
<dark>
you could say that + has type 'a -> 'a -> 'a, for Num('a), then + can receive int or floats or any type you create that is part of Num type class
<hcarty>
OCaml's lack of operator overloading/type classes bothered me at first, but now I like the clarity it provides
<hcarty>
pa-do and local module open can make things a bit murkier, but ( + ) still only means one thing in a given context.
<dark>
but ocaml also has a mechanism for specifying capabilities of a type: the class system. but once you defined a class, you can't extend it later (you can create a derived class, but not add things into it). also, it's expensive..
<hcarty>
dark: And the type errors become much harder to read :-)
<dark>
type classes have this interesting thing where the type can be given attributes by its users
<dark>
hcarty, mhmmm.. well, yes, but ocaml's type errors are actually nice.. a lot of things are turned into class names
<dark>
hcarty, but even the sml's way of ad hoc overloading feels better, imo :(
<hcarty>
dark: The length of the generated errors can become cumbersome at times without extra type annotation
<dark>
haskell seems to have a similar problem, too
<hcarty>
I really like that OCaml, for most of the core language, doesn't require any type annotation.
<dark>
nobody here knows ocamldebug? I'm with printfs here, but the issue is inside of some library that I'm using, and I don't want to go editing their code.. just set some breakpoint, then show a backtrace, and I'm satisfied
init1 has quit [Quit: Quitte]
<dark>
ok, my prints were appearing at the wrong time because i didn't flush stdout..
Yoric has quit [Quit: Yoric]
<adrien>
Printf.printf "pouet\n%!"
<dark>
Magick.ping_image_infos "something.html", from OCaml-ImageMagick, somehow, calls html2ps
<dark>
but it does not have the string html2ps at the source code, and imper_ping_image_infos (which is a very tiny C code) has nothing about it.. maybe imagemagick itself has this?
<dark>
annoying
<dark>
sh: html2ps: command not found
<dark>
yes imagemagick is the culprit
lpereira has joined #ocaml
Edward_ has joined #ocaml
Edward_ has quit [Client Quit]
Edward_ has joined #ocaml
lpereira has quit [Quit: Leaving.]
krankkatze has joined #ocaml
drunK has quit [Remote host closed the connection]