dark_light changed the topic of #ocaml to: OCaml 3.09.2 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
jcreigh has joined #ocaml
Mr_Awesome has joined #ocaml
<Mr_Awesome> is it possible for a functor to take multiple arguments
<zmdkrbou> yes i think so
<Mr_Awesome> do you happen to know the syntax?
<zmdkrbou> i don't remember precisely, but i think it involves parentheses
<zmdkrbou> like Myfunctor (A:bla) (B:bli)
<Mr_Awesome> is that the same for the functor declaration? ive tried functor (A:x; B:y), functor (A:x; B:y), functor (A:x) (B:y) and nothing seems to work
<zmdkrbou> hmmm i don't remember much of this :)
<zmdkrbou> it should be well explained in the manual
<Mr_Awesome> functor ( module-name :  module-type ) ->  module-type is all that the manual gives for a functor declaration
<zmdkrbou> and for application ?
<Mr_Awesome> module-expr1 (  module-expr2 )
<zmdkrbou> :\
beschmi has quit ["Leaving"]
jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
<Mr_Awesome> you seem like you have done multiple argument functors, zmdkrbou
<zmdkrbou> not that i remember, i don't use functors much :\
<Mr_Awesome> ok
<zmdkrbou> i just thought it worked simply
<zmdkrbou> looks like i'm wrong, that's uncool if this doesn't work ...
<Mr_Awesome> i dont really have any specific use in mind, and maybe ill never need it, but it just seemed like there should be a way to have multiple arg functors
gottreu_ has joined #ocaml
chessguy has joined #ocaml
<Smerdyakov> Mr_Awesome, the manual has the complete information you need to write the module types of multiple argument functors.
<Smerdyakov> Mr_Awesome, hint: it's the exact analogue of multiple argument functions.
<Mr_Awesome> i tried functor (A:x) -> (B:y) -> C if thats what you mean
<Smerdyakov> Nope, that's not the analogue of a curried function type.
<Smerdyakov> Give up?
<Mr_Awesome> no
<Mr_Awesome> is "val f : x -> y -> z" the analogue i should be looking at?
<Smerdyakov> Yes. A curried function type has the same syntactic process applied N times to the return type. This translates simply to module types.
<Mr_Awesome> ok, thanks i figured it out
<Mr_Awesome> i was extremely close with the last thing i tried
shawn has joined #ocaml
<Mr_Awesome> i thought of doing nested functors like that, but for some reason i had the idea that it would require a lot of ugly syntax
chessguy has quit [" Try HydraIRC -> http://www.hydrairc.com <-"]
chessguy has joined #ocaml
jcreigh has joined #ocaml
pango_ has joined #ocaml
pango has quit [Remote closed the connection]
jcreigh has quit ["Cuius rei demonstrationem mirabilem sane detexi. Hanc marginis exiguitas non caperet."]
gottreu_ has quit [Read error: 110 (Connection timed out)]
gottreu_ has joined #ocaml
Smerdyakov has quit ["Leaving"]
Mr_Awesome has left #ocaml []
Godeke has quit ["Leaving"]
jewel has joined #ocaml
Wild_Cat has joined #ocaml
_velco is now known as velco
ramenboy has joined #ocaml
Wild_Cat has quit []
velco is now known as _velco
ramenboy has quit [Connection timed out]
smimou has joined #ocaml
pango_ has quit [Remote closed the connection]
pango has joined #ocaml
fab__ has joined #ocaml
_fab has quit [Read error: 113 (No route to host)]
gottreu__ has joined #ocaml
gottreu_ has quit [Read error: 110 (Connection timed out)]
Wild_Cat has joined #ocaml
chessguy2 has joined #ocaml
smimou has quit ["bli"]
velco has joined #ocaml
chessguy has quit [Success]
SYStems has joined #ocaml
zmdkrbou has quit [Read error: 113 (No route to host)]
zmdkrbou has joined #ocaml
SYStems has left #ocaml []
TSC has joined #ocaml
Carillon has joined #ocaml
d-bug has joined #ocaml
Carillon_ has quit [Connection timed out]
Carillon is now known as Carillon_
youknow365 has quit [Read error: 104 (Connection reset by peer)]
bourbaki has joined #ocaml
<bourbaki> moin
<zmdkrbou> plu
TSC has quit [Remote closed the connection]
slipstream has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
TSC has joined #ocaml
finelemon has joined #ocaml
Snark has joined #ocaml
finelemo1 has quit [Read error: 110 (Connection timed out)]
<bourbaki> has anyone of you ever tried f#?
DRMacIver has quit [Read error: 110 (Connection timed out)]
finelemon has quit [Read error: 110 (Connection timed out)]
fab__ has quit []
gottreu_ has joined #ocaml
gottreu__ has quit [Read error: 110 (Connection timed out)]
bourbaki has left #ocaml []
beschmi has joined #ocaml
gottreu_ has quit ["Ex-Chat"]
chessguy2 is now known as chessguy
chessguy has quit [Client Quit]
<flux__> hmm.. say I have an a list like [`A, `B, `C 42, `D "foo"], where elements may be in arbitrary order, what would be the most convenient way to build a record that { a : bool; b : bool; c : int; d : string } of it?
<flux__> I can only imagine simple solutions for handling `A and `B..
<flux__> if the element is missing, I should generate an exception, or maybe the field is 'a option in the record
<flux__> is this a place for a language extension?-)
<Snark> flux__: I would say your design is broken...
<flux__> I suppose I could change it
<flux__> but that seemed so convenient
<flux__> what is the most convenient way to read an input like [("Status"; "OK"), ("Foo", "42"), ("Bar"; "Baz")] into a record then?
<flux__> uh, , and ;'s are wrong way :-)
<flux__> actually the input is [["Status"; "OK"]; ["Foo"; "44"]; ["Bar"; "Baz"]] (well almost)
<flux__> a somewhat convenient way is to make the record have loads of option fields, and originally initialize them to None and incrementally create the record with all 'Some' fields
<flux__> but that would essentially need two records
<zvrba> so you want a hashtable or a map?
<pango> depends what you want in output... If it's ok to return "partial" records, then yes
<pango> otherwise, you're just pushing the problem on step later
<flux__> no, I want a record
<zvrba> it seems that a map is most appropriate
<flux__> I have only a few fields
<zvrba> why do you want a record?
<zvrba> so what how many records there are?
<flux__> compiler can statically check it
<zvrba> so can check the map
<zvrba> for the types at least
<zvrba> then stuff all fields you need in a record as option types
<flux__> well, I could of course put integers and strings into a map with sum types, but using them would be very inconvenient
<flux__> and eventually I know that "status" will always be bool
<flux__> it would be difficult to take advantage of that information with map
<zvrba> i have a feeling that you're overcomplicating
<flux__> it's not overcomplicating to have a simple record with a few fields
<flux__> it's the reading that seems needlessly complicated
gottreu has joined #ocaml
<pango> I'd put all input data in some set keyed on first string (assoc list, hash table, whatever fits your performance needs), and build the record from it
<flux__> I have very few items
kral has joined #ocaml
<flux__> thanks for the suggestions. I now have { rs_status = find "Status" (function "OK" :: _ -> Some R_OK | "Fail" :: _ -> Some R_Fail | "Disabled" :: _ -> Some R_Disabled | _ -> raise Protocol_error); etc
<flux__> hm, actually, I wonder why I used the 'Some'-type
<flux__> right, it was remains of the previous idea ;)
<flux__> I suppose it'll be simpler if I drop support for multiple columns
<flux__> find is let find = find_aux (list_of_response response), so I can factor find_aux nicely out to be reused in other functions
beschmi has left #ocaml []
<flux__> and initialization is very convenient with for example integer keys: rs_key = find "Key" int_of_string
<pango> if you reverse the arguments, you can create curried versions; let find_int = find int_of_string ...
<flux__> yes, although I prefer the other version for the case with pattern matching
<pango> find stays usable as is
bzzbzz has joined #ocaml
jewel has quit ["Leaving"]
Smerdyakov has joined #ocaml
chessguy has joined #ocaml
velco has quit ["Ex-Chat"]
kral has quit ["rcirc on GNU Emacs 22.0.50.1"]
smimou has joined #ocaml
Wild_Cat has quit ["Leaving"]
smimram has joined #ocaml
Godeke has joined #ocaml
Godeke_ has joined #ocaml
Godeke has quit [Client Quit]
Godeke_ has quit [Read error: 104 (Connection reset by peer)]
Godeke has joined #ocaml
_jol_ has joined #ocaml
smimou has quit [Read error: 110 (Connection timed out)]
lectus has joined #ocaml
pango_ has joined #ocaml
pango has quit [Remote closed the connection]
lectus has left #ocaml []
pango_ is now known as pango
_jol_ has quit ["temci lo nu citka"]
mwc has joined #ocaml
smimram has quit [Read error: 104 (Connection reset by peer)]
smimou has joined #ocaml
_jol_ has joined #ocaml
mwc has left #ocaml []
shekmalhen has joined #ocaml
postalchris has joined #ocaml
dmitri83 has joined #ocaml
dmitri83 has left #ocaml []
Snark has quit ["Leaving"]
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- State of the art IRC"]
_jol_ has quit ["temci lo nu sipna .i co'o rodo"]
Carillon has joined #ocaml
ramkrsna has quit [Read error: 110 (Connection timed out)]
shekmalhen has quit ["beeeeh"]
Carillon_ has quit [Connection timed out]
Carillon is now known as Carillon_
_velco has quit ["I'm outta here ..."]
smimou has quit ["bli"]
ramkrsna has joined #ocaml
shawn has quit [Read error: 110 (Connection timed out)]
shawn has joined #ocaml
gottreu has left #ocaml []
postalchris has left #ocaml []
beschmi has joined #ocaml