mfp changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.11.2 released | Inscription for OCaml Meeting 2010 is opened http://wiki.cocan.org/events/europe/ocamlmeetingparis2010
orbitz has joined #ocaml
tmaedaZ is now known as tmaeda
{newbie} has quit [Remote host closed the connection]
derdon has quit [Quit: derdon]
boscop has quit [Quit: Gxis revido!]
tmaeda is now known as tmaedaZ
MrHeavy has quit [Read error: Operation timed out]
MrHeavy has joined #ocaml
_unK has quit [Remote host closed the connection]
hsuh has joined #ocaml
<hsuh> does ocamlex/ocamlyacc work with the ms toolchain?
Mr_Awesome has quit [Quit: Hilarity ensues.]
pad has joined #ocaml
mfp has quit [Read error: Connection reset by peer]
sepp2k1 has quit [Quit: Leaving.]
mfp has joined #ocaml
albacker has joined #ocaml
enthymene has quit [Quit: rcirc on GNU Emacs 23.1.1]
Drk-Sd has quit [Quit: dodo]
bzzbzz has quit [Quit: leaving]
pad has quit [Remote host closed the connection]
caligula_ has joined #ocaml
caligula__ has quit [Ping timeout: 265 seconds]
<thelema> hsuh: if there's any bug with ocamllex/yacc, it's a bug and should be reported to the ocaml devs for fixing.
enthymene has joined #ocaml
mbishop has quit [Ping timeout: 265 seconds]
mbishop has joined #ocaml
mbishop_ has joined #ocaml
mbishop has quit [Ping timeout: 276 seconds]
mbishop__ has joined #ocaml
mbishop_ has quit [Ping timeout: 264 seconds]
Submarine has joined #ocaml
mbishop__ has left #ocaml []
mbishop has joined #ocaml
<mbishop> that was weird
<mbishop> told me I couldn't change name while banned in this channel...and I couldn't talk in here either
julm has quit [Quit: pff]
<thelema> mbishop: yes, because of spam problems, #ocaml got an extra flag that makes name changes annoying
<mbishop> ah
julm has joined #ocaml
Submarine has quit [Ping timeout: 256 seconds]
valross has quit [Quit: Ex-Chat]
ulfdoz has joined #ocaml
ttamttam has joined #ocaml
ttamttam has quit [Quit: Leaving.]
orbitz has quit [Read error: Connection reset by peer]
orbitz has joined #ocaml
_zack has joined #ocaml
ulfdoz has quit [Ping timeout: 256 seconds]
ttamttam has joined #ocaml
f[x] has joined #ocaml
enthymene has quit [Quit: g'night freenode.]
maattd|away is now known as maattd
jcaose has joined #ocaml
avsm has joined #ocaml
orbitz has quit [Read error: Connection reset by peer]
orbitz has joined #ocaml
Yoric has joined #ocaml
avsm has quit [Quit: Leaving.]
ikaros has joined #ocaml
pimmhogeling has joined #ocaml
jcaose_ has joined #ocaml
jcaose has quit [Ping timeout: 245 seconds]
sepp2k has joined #ocaml
_zack has quit [Quit: Leaving.]
ikaros has quit [Quit: Leave the magic to Houdini]
_zack has joined #ocaml
avsm has joined #ocaml
<albacker> if i compile a simple.ml file using this ``ocamlc -I +curl curl.cma simple.ml -o simple". How can i open the curl library while on ocaml?
<albacker> ok i found this out.
pimmhogeling has quit [Ping timeout: 265 seconds]
oc13 has joined #ocaml
oc13 has left #ocaml []
sepp2k has quit [Quit: Leaving.]
pimmhogeling has joined #ocaml
boscop has joined #ocaml
pimmhogeling has quit [Remote host closed the connection]
pimmhogeling has joined #ocaml
maattd is now known as maattd|away
_andre has joined #ocaml
maattd|away is now known as maattd
<flux> caml ml is quite quiet?
Asmadeus has quit [Quit: brb, moving]
Asmadeus has joined #ocaml
Camarade_Tux has quit [Quit: leaving]
<albacker> is it elegant to exit a loop with an exception?
Camarade_Tux has joined #ocaml
<albacker> like here : http://pastebin.com/RQVmuLzL (even though code doesn't work...yet)
<flux> no
<flux> I was going to say use Array.find, but it doesn't have such a function :)
<flux> maybe possible_extensions should rather be a list, anyway..
<albacker> hmm.. i thought since it's always fixed size it would be good to have array. but yeah in my case it makes no difference.
<flux> with list the function would be like: let get_name ext = snd (List.find (fun (a, _) -> a = ext) possible_extensions) (except for the special case of not finding the value)
<flux> for that using exceptions would be ok, if not for only other reason because ocaml doesn't support returning option types from List.find :)
<albacker> don't spoil my code :(
<flux> :)
<flux> in ocaml one would always use lists, unless you need constant time indexing or possibly mutability
<flux> with lists it's easier to write recursive functions
<albacker> well i can't use snd and fst in my case since i'll have a triplet.
<flux> oh, ok
<flux> perhaps you should consider using records in that case
<flux> because it looks like to me you are using a string array when the index has a fixed meaning
<flux> basically you're using a non-compiler-verified version of tuples
<flux> (or perhaps I don't understand what's the function of getName)
<flux> oh right, and usually ocamlers prefer lowercase_symbols_without_CamelCase. but of course you are free to go as you want, but this approach is least likely to cause funny-looking code when you use other libraries :)
<albacker> i had an array of arrays of form [|string1;string2;string3|], and i got a string as input of my function (getName) and compared it to every string1 in the array (possible_extensions) and i returned string2 whenever i found smth
<flux> what's string3 used for?
<albacker> for later maybe.
<flux> what do you have in there now?
<albacker> another string.
<albacker> =D
<flux> I think something like type extension_info = { ext : string; name : string; aux : string } would do fine here
<albacker> yeah.. probably, but i'm not really comfortable with records -_-
<albacker> ok i'll do it this way, better to learn coding clean once then go wrong all time </positive_thinking>
<albacker> thanks flux
boscop_ has joined #ocaml
boscop has quit [Ping timeout: 240 seconds]
<albacker> flux, http://pastebin.com/URfWMWWP does this look any good?
<flux> albacker, yes, it's fine (although it could be using List.find). you also don't need to match for ..; aux = aux_value} if you don't need the aux value there.
<flux> actually what you could do would be: let rec aux l = match l with [] -> "txt" | { ext = ext_value; name = name_value }::_ when ext_value = ext -> name_value | _::t -> aux t
<albacker> oh that "when" -_-
<albacker> thanks again.
Drk-Sd has joined #ocaml
ttamttam1 has joined #ocaml
ttamttam has quit [Read error: Connection reset by peer]
spearalot has joined #ocaml
rwmjones has quit [Ping timeout: 245 seconds]
Shoggoth has joined #ocaml
<albacker> has anyone had any experience with curl? (ocaml curl)
derdon has joined #ocaml
Shoggoth has quit [Quit: Ex-Chat]
<_andre> fg
<_andre> oops :p
rwmjones has joined #ocaml
mutew is now known as mutewit
<f[x]> don't ask to ask, just ask
<albacker> well i couldn't find any code/documentation for ocurl just the .mli ( http://docs.camlcity.org/docs/godipkg/3.10/godi-curl/lib/ocaml/pkg-lib/curl/curl.mli ), and some .c code that uses curl ( this for ex: http://curl.haxx.se/libcurl/c/postit2.html ). but the structure for HTTPPos seems different in the C code and the .mli file. The C code is more similar to the commented type in the .mli. i just wanted to ask if someone can explain me where the CURL_COPYN
<albacker> AME was in the .mli : f[x]
<albacker> CURLFORM_COPYNAME *
maattd is now known as maattd|away
<f[x]> there is no docs for ocurl - true, because it is really a thin wrapper over libcurl
matthieu has joined #ocaml
<f[x]> looks like ocurl doesn't implement this option for httppost
<f[x]> actually no, looks like it implements it, | CURLFORM_CONTENT of string * string * curlContentType
maattd|away has quit [Ping timeout: 264 seconds]
{newbie} has joined #ocaml
bzzbzz has joined #ocaml
<f[x]> the first string is form name and the other is contents
<f[x]> it doesn't expose COPYNAME because it is not-needed (too low level for gc memory management)
<albacker> hmm.. i get an exception :/
det has joined #ocaml
<albacker> f[x], what about the CURLFORM_FILE and CURLFORM_FILECONTENT ?
<albacker> one string is filename.
pimmhogeling has quit [Ping timeout: 265 seconds]
<f[x]> form name and file name
{newbie} has quit [Ping timeout: 268 seconds]
spearalot has quit [Quit: -arividerchi]
{newbie} has joined #ocaml
Smerdyakov has joined #ocaml
pimmhogeling has joined #ocaml
{newbie} has quit [Quit: {newbie}]
Smerdyakov has quit [Quit: Leaving]
ikaros has joined #ocaml
lokydor has joined #ocaml
avsm has quit [Quit: Leaving.]
lokydor has quit [Client Quit]
<albacker> i failed, this http://pastebin.org/107477 does not do what it was meant to (paste the "something to paste" string in pastebin, and return URL). in fact it hangs and gives no output :/
ikaros has quit [Quit: Leave the magic to Houdini]
{newbie} has joined #ocaml
pimmhogeling has quit [Ping timeout: 265 seconds]
f[x] has quit [Ping timeout: 248 seconds]
f[x] has joined #ocaml
maennj has joined #ocaml
<maennj> hello
slash_ has joined #ocaml
<maennj> can someone tell me what am I doing wrong here http://pastebin.com/Em3AkRGj
<Camarade_Tux> 'lookup(name,binding)', I guess this should be 'lookup name binding', arguments have to be separated by spaces not commas
<maennj> ooh
<Camarade_Tux> and the '|' should be on the newline, next to 'Frame' not on the first one
<Camarade_Tux> it won't break anything but it makes the code pretty hard to read
<Camarade_Tux> hi maennj
<maennj> ah ok, thanks a lot :)
<maennj> it worked
<albacker> f[x], thanks.
<albacker> so all i was doing was wrong?
<f[x]> yep, read how http post works and read tutorials on curl site
_unK has joined #ocaml
avsm has joined #ocaml
pimmhogeling has joined #ocaml
<maennj> I'm trying to make 'context' type which is basically a list of mappings between names and values, I'm also trying to define a lookup function that looks for the given name in the given context and returns the value.. I'm new to OCaml, can someone tell me what's wrong in my code : http://pastebin.com/r6cvau35
<maennj> I'm getting Error: This expression has type context but an expression was expected of type int
<avsm> it should be (Some value)
<avsm> since you return None in another part of the pattern match
<maennj> ooh
<avsm> also, the second binding wont ever match
<Camarade_Tux> also, I think the second pattern-match for Binding is unused
<Camarade_Tux> you should get a warning about it
<maennj> hmm
<maennj> yea I got warning :/
joewilliams_away is now known as joewilliams
<Camarade_Tux> why two different cases?
<maennj> because if name doesn't match with the head
<maennj> I'm not sure if that's the right way to do it :)
<maennj> I mean, I imagine the context as linked list , each node contains a string and integer and link to the rest of the list
<Camarade_Tux> oh, I see: you're actually defining a new variable here: you can use 'when' here (extension of the language):
<Camarade_Tux> Binding(binding_name, value, _) when binding_name = name -> value
<Camarade_Tux> |Binding(_, _, ctx) -> lookup name ctx
<maennj> ooh ok, I thought I'm using the same name :)
<maennj> cool no warnings now, thanks a lot
<Camarade_Tux> or also use 'Binding(binding_name, value, ctx) -> if binding_name = name then value else lookup name ctx'
<Camarade_Tux> :-)
<maennj> :) 'when' looks more readable
<maennj> this language is so expressive
{newbie} has quit [Quit: {newbie}]
joewilliams is now known as joewilliams_away
sepp2k has joined #ocaml
_zack has quit [Quit: Leaving.]
ttamttam1 has quit [Quit: Leaving.]
jcaose_ has quit [Ping timeout: 245 seconds]
{newbie} has joined #ocaml
maennj has left #ocaml []
joewilliams_away is now known as joewilliams
seanmcl has joined #ocaml
ztfw has joined #ocaml
<albacker> f[x], i used that code to make this : http://pastebin.org/107570
<albacker> it works, but it might need _a lot_ of modifications.
<albacker> apparently it doesn't work preety well because this line : let tmp = "&" in is in fact let tmp = "%26" in .
<albacker> -_-'
<albacker> unless i convert to hex every single char i read, but don't know if that would be one solution.
Yoric has quit [Quit: Yoric]
_zack has joined #ocaml
pimmhogeling has quit [Ping timeout: 265 seconds]
avsm has quit [Quit: Leaving.]
ulfdoz has joined #ocaml
pimmhogeling has joined #ocaml
ygrek has joined #ocaml
enthymene has joined #ocaml
fraggle_ has quit [Quit: -ENOBRAIN]
fraggle_ has joined #ocaml
Drk-Sd has quit [Quit: {'EXIT', Drk-Sd, "bye"}]
seanmcl has quit [Quit: seanmcl]
thieusoai has joined #ocaml
ttamttam has joined #ocaml
avsm has joined #ocaml
ski has joined #ocaml
pad has joined #ocaml
rwmjones has quit [Ping timeout: 245 seconds]
jcaose has joined #ocaml
f[x] has quit [Ping timeout: 240 seconds]
f[x] has joined #ocaml
joewilliams is now known as joewilliams_away
avsm has quit [Quit: Leaving.]
rwmjones has joined #ocaml
_andre has quit [Quit: *puff*]
enthymene has quit [Quit: rcirc on GNU Emacs 23.1.1]
jao has joined #ocaml
lokydor has joined #ocaml
enthymene has joined #ocaml
<albacker> what causes this kind of output : http://pastebin.com/hKGn4FTL ?
<{newbie}> the \"
<{newbie}> in the middle of the string
pimmhogeling has quit [Read error: Connection reset by peer]
<albacker> how can i put " inside a string then?
<mfp> albacker: assuming you refer to the program itself (not pastebin's broken formatting :), probably String.index, which can raise Not_found IIRC
<{newbie}> I was talking about the broken formating
<albacker> mfp, i see..
<albacker> i think the script reads \n and goes to find \n in the string.
<albacker> mfp, thanks.
<gildor> all: a DNS server of the OVH datacenter seems down, ocamlcore.org is unreachable for now
ztfw has quit [Remote host closed the connection]
avsm has joined #ocaml
ttamttam has quit [Quit: Leaving.]
sepp2k1 has joined #ocaml
sepp2k has quit [Ping timeout: 265 seconds]
_zack has quit [Quit: Leaving.]
Modius has joined #ocaml
Modius has quit [Max SendQ exceeded]
Modius has joined #ocaml
pimmhogeling has joined #ocaml
boscop_ has quit [Quit: Gxis revido!]
boscop has joined #ocaml
enthymene has quit [Quit: rcirc on GNU Emacs 23.1.1]
thieusoai has quit [Quit: Leaving]
slash_ has quit [Quit: Lost terminal]
derdon has quit [Quit: derdon]
ulfdoz has quit [Ping timeout: 258 seconds]
ygrek has quit [Ping timeout: 245 seconds]
avsm has quit [Quit: Leaving.]
{newbie} has left #ocaml []
lokydor has quit [Ping timeout: 245 seconds]
albacker has quit [Ping timeout: 276 seconds]
enthymene has joined #ocaml
<hsuh> thelema: no bugs, i just thought for a minute that ocamlex/yacc only worked with the cygwin toolchain
boscop has quit [Quit: Gxis revido!]
joewilliams_away is now known as joewilliams
pimmhogeling has quit [Ping timeout: 245 seconds]
Drk-Sd has joined #ocaml
pimmhogeling has joined #ocaml
alp has joined #ocaml
Alpounet has quit [Disconnected by services]
ikaros has joined #ocaml
Drk-Sd has quit [Client Quit]
Drk-Sd has joined #ocaml
Alpounet has joined #ocaml
alp has quit [Ping timeout: 260 seconds]
alp has joined #ocaml
alp has quit [Client Quit]
alp has joined #ocaml
alp has quit [Read error: Connection reset by peer]
alp has joined #ocaml
Alpounet has quit [Read error: No route to host]
alp has quit [Read error: Connection reset by peer]
Alpounet has joined #ocaml
sepp2k1 has quit [Quit: Leaving.]
<gildor> all: DNS for ocamlcore.org seems fine now
Alpounet has quit [Ping timeout: 248 seconds]
Alpounet has joined #ocaml
avsm has joined #ocaml
bzzbzz has quit [Ping timeout: 248 seconds]
Amorphous has quit [Ping timeout: 265 seconds]
ikaros has quit [Quit: Leave the magic to Houdini]
jcaose has quit [Ping timeout: 245 seconds]
avsm has quit [Quit: Leaving.]
avsm has joined #ocaml
Amorphous has joined #ocaml