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/
johnnowak has joined #ocaml
rillig has quit ["exit(EXIT_SUCCESS)"]
mikeX has joined #ocaml
dbueno_ has joined #ocaml
bebui has joined #ocaml
bebui has quit [Client Quit]
bebui has joined #ocaml
bebui has quit [Client Quit]
bebui has joined #ocaml
swater_ has quit ["Quat"]
bmiller has quit []
ulfdoz has quit [Read error: 110 (Connection timed out)]
bebui has quit [Read error: 104 (Connection reset by peer)]
bebui has joined #ocaml
delamarche has joined #ocaml
bebui has quit [Client Quit]
bebui has joined #ocaml
danly has quit ["Leaving"]
bebui has quit [Client Quit]
bebui has joined #ocaml
bebui has quit [Client Quit]
delamarche has quit [Client Quit]
bebui has joined #ocaml
bebui has quit [Client Quit]
bebui has joined #ocaml
bebui has quit [Client Quit]
postalchris has joined #ocaml
postalchris has left #ocaml []
delamarche has joined #ocaml
johnnowak has quit []
delamarche has quit [Client Quit]
bebui has joined #ocaml
bebui has quit [Client Quit]
bebui has joined #ocaml
<dbueno_> Is there a nice way to write ocamldoc comments that have @param tags for function declarations in signatures?
<dbueno_> (Forget "nice"; is there even a way?)
ziggurat has quit ["Leaving"]
danly has joined #ocaml
clog has joined #ocaml
postalchris has joined #ocaml
chessguy has joined #ocaml
iFreeCarve has quit [Read error: 60 (Operation timed out)]
batdog|gone is now known as batdog
clog_ has joined #ocaml
khaladan_ has joined #ocaml
clog has quit [Read error: 110 (Connection timed out)]
clog_ is now known as clog
khaladan has quit [Connection timed out]
khaladan_ is now known as khaladan
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- IRC with a difference"]
khaladan_ has joined #ocaml
sponge45 has joined #ocaml
khaladan has quit [Read error: 110 (Connection timed out)]
khaladan_ is now known as khaladan
dark_light has joined #ocaml
<dark_light> i am with an strange syntax error, http://nopaste.tshw.de/1162267318907cd/ , in an match, can someone see it?
<Smerdyakov> That's great. "I am with a syntax error."
<dark_light> Smerdyakov, in the paste i posted where i am with the error
<dark_light> i don't know why i got this error, i though i could do it
<Smerdyakov> I just like the English, that's all. ;)
<dark_light> ah
<Smerdyakov> All constructors begin with capital letters in OCaml.
<Smerdyakov> Only constructors may be applied in patterns.
<dark_light> ah hmm so i must use when?
<Smerdyakov> And constructors are the only things that can be projected out of modules in patterns.
<Smerdyakov> That might be the best idea.
<dark_light> ps: yes, my english is really bad, :E
<Smerdyakov> No, no, now I want a "I am with a syntax error" T-shirt!
<dark_light> ahn, err :o hahahahaha
khaladan_ has joined #ocaml
clog has joined #ocaml
clog has joined #ocaml
khaladan_ has joined #ocaml
ulfdoz has joined #ocaml
khaladan has quit [Read error: 110 (Connection timed out)]
khaladan_ is now known as khaladan
Snark has joined #ocaml
khaladan_ has joined #ocaml
khally has joined #ocaml
khaladan has quit [Read error: 110 (Connection timed out)]
khally is now known as khaladan
khaladan_ has quit [Read error: 110 (Connection timed out)]
dibblego has quit ["Leaving"]
pango_ has joined #ocaml
khaladan_ has joined #ocaml
pango has quit [Remote closed the connection]
khaladan has quit [Read error: 110 (Connection timed out)]
khaladan_ is now known as khaladan
ramkrsna has quit [Read error: 104 (Connection reset by peer)]
ramkrsna has joined #ocaml
sponge45 has quit ["zzzzzzzzzz"]
_fab has joined #ocaml
fab_ has joined #ocaml
fab_ has quit [Remote closed the connection]
delamarc1e has joined #ocaml
danly has quit [Remote closed the connection]
dark_light has quit [Read error: 110 (Connection timed out)]
_velco has joined #ocaml
_velco is now known as velco
ikaros_ has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
yondalf has joined #ocaml
pango_ has quit [Remote closed the connection]
yondalf has quit [Read error: 104 (Connection reset by peer)]
yondalf has joined #ocaml
pango has joined #ocaml
yondalf_ has joined #ocaml
yondalf has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
gim has quit [Read error: 110 (Connection timed out)]
slipstream-- has joined #ocaml
ppsmimou has quit [Read error: 110 (Connection timed out)]
yondalf_ has quit [Read error: 110 (Connection timed out)]
slipstream has quit [Read error: 110 (Connection timed out)]
malc_ has joined #ocaml
gene9 has joined #ocaml
dark_light has joined #ocaml
<dark_light> anyone here has some experience with ocaml's Unix.recv? because the POSIX recv receives only one int as argument (the buffer size), but the ocaml's receives two, and the function doesn't seems to be documented
<gene9> Hi, can anybody help me with types, I found strange type definition and have no idea where to read about it. This is a link - http://deadbeefbabe.org/paste/2397
<dark_light> gene9, the second is a way to mix variant types..
<dark_light> because i can have type x = `A | `B and type y = `C | `D and have: match variable with `A | `B -> print_endline "variable has type x" | `C | `D -> print_endline "variable has type y"
<gene9> dark_light, oh, I see, thank you!
<flux__> dark_light, did you figure it out already?
<dark_light> flux__, no
<flux__> dark_light, many functions that use string as a receive/send buffer get an offset to the string
<flux__> so it's like string offset length
<dark_light> hmmmm intersting
<flux__> it's not a bad convention, it reduces copying
<dark_light> flux__, so instead of using a Buffer.t to store the read and keep adding the string, i should move the offset?
<dark_light> seems nice
<flux__> dark_light, well, you can do it either way
<flux__> dark_light, but let's say you want to read 1024 bytes
<dark_light> Hmm
<flux__> dark_light, I'd say it's much better to use the same string instead of using Buffer
<flux__> because that would introduce copying
<flux__> (and you want to use some solution because Unix.recv might return less than n bytes, but I imagine you knew that already)
<dark_light> (yeah)
<dark_light> -1 for error and 0 for shutdown is kept in ocaml?
<dark_light> i was about to test it but i don't really know how raise an socket error
gene9 has quit ["Leaving"]
<dark_light> hmm, well, for reading a arbitrary lengthed string a buffer seems better.. (and I love arbitrary-sized arguments, seems so.. powerful..)
<flux__> yes
<flux__> uh, no :-)
<flux__> it raises an exception on -1
<dark_light> this thing should be documented!
<flux__> Unix.Unix_error of (code, _, _)
<dark_light> hmm, yes. for now it seems like only EINTR is suitable for handling
ppsmimou has joined #ocaml
gim has joined #ocaml
<dark_light> and the rest means, well, the socket is gone..
bebui has quit [Remote closed the connection]
velco has quit ["I'm outta here ..."]
Slack4020 has quit [niven.freenode.net irc.freenode.net]
shawn has quit [niven.freenode.net irc.freenode.net]
Nutssh has quit [niven.freenode.net irc.freenode.net]
Slack4020 has joined #ocaml
shawn has joined #ocaml
Nutssh has joined #ocaml
buluca has joined #ocaml
bluestorm has joined #ocaml
Snark has quit [Connection reset by peer]
Snark has joined #ocaml
swater has joined #ocaml
systems has joined #ocaml
bluestorm has quit ["Leaving"]
Leonidas has joined #ocaml
l_a_m has joined #ocaml
<dark_light> try 1 with Invalid_argument x when x = "String.sub" | Not_found -> 2, anyone knows why i get an syntax error at the "|"?
<dark_light> try 1 with Invalid_argument x when x = "a" -> 2;; and try 1 with Not_found -> 2 | Exit | Failure _ -> 3;; works..
<malc_> dark_light: strange, but your first attempt ought to be rejected anyhow (x is unbound in second match)
<dark_light> malc_, !!! hmmmmmm
<malc_> but time to part
malc_ has quit ["leaving"]
<dark_light> that's explain the syntax error, :)
<dark_light> well, post-bye, heh
systems has quit [Remote closed the connection]
pango has quit [Remote closed the connection]
pango has joined #ocaml
delamarc1e has quit []
Sweetsha1k has joined #ocaml
Sweetshark has quit [Read error: 113 (No route to host)]
bebui has joined #ocaml
flux__ has quit [Read error: 104 (Connection reset by peer)]
flux__ has joined #ocaml
Leonidas has quit ["An ideal world is left as an exercise to the reader"]
Sweetshark has joined #ocaml
Sweetsha1k has quit [Read error: 60 (Operation timed out)]
unfo- has joined #ocaml
<unfo-> let first_message = "Hello World!"
Smerdyakov has joined #ocaml
bmiller has joined #ocaml
<swater> Are there any existing implementation of neural networks in ocaml?
<unfo-> woah. that PLEAC url in the topic is awesome. and thanks for putting it there. removed about half a dozen questions I had :)
<Smerdyakov> unfo-, what a horrible idea. The tasks are probably chosen to be Perl-like.
<unfo-> Smerdyakov, *shrug* possible, but simple stuff like how to make a string out of a number and then go thru that string char by char etc
<Smerdyakov> unfo-, I rarely use numbers. :)
<unfo-> Smerdyakov, I started looking into O'Caml yesterday so I am on the veeeery low level still :)
<mellum> Yeah, numbers are for sissies.
<unfo-> Smerdyakov, I'm doing a Project Euler math problem
<unfo-> I find them to very good cannon fodder when learning a language
<Smerdyakov> unfo-, not if you're more interested in symbolic problems.
<unfo-> Smerdyakov, like what?
<Smerdyakov> unfo-, the thing is that no languages outside of ML and Haskell (maybe Lisp family) are any good for symbolic problems, so no one aiming to be so mainstream would pose any. :)
<Smerdyakov> unfo-, all manner of compilation, theorem proving, program analysis, ...
<unfo-> Smerdyakov, okay.. that's true.. haven't ran into those topics that often as "test problems"
<Smerdyakov> The problems you mention are irrelevant if you have no interest in their domains.
<unfo-> well they are not irrelevant to me, since I enjoy solving math problems. and it is a good way to get used to the very basics of the OCaml language in my perspective. once I have put my feet down with the language I can start looking at real-world problems I need to solve
<Smerdyakov> It's a historical accident that numbers are the primary thing associated with math.
<Smerdyakov> The essence of math is proof.
<Smerdyakov> And theorem proving systems sure have plenty of that.
<unfo-> these math problems are equal and above my skill level in math
<unfo-> and I have no idea how or where I would go about with theorem proving systems :)
<Smerdyakov> I find it's usually most effective to learn a language by starting to use it for the thing you meant to do with it in the first place.
<unfo-> well I currently don't yet know what I'll do with it since learning OCaml is just that - a learning process for me. I've never done functional programming and I was suggested that OCaml might be worthy
<unfo-> so now I want to get a feel for the language so I can see what I could do with it
<Smerdyakov> You will have trouble if you don't have any projects in mind.
<unfo-> how so?
<Smerdyakov> You can't be self-directed without a goal, and it's inefficient to rely on direction from others for every step you take.
<unfo-> the only thing I could think of yesterday was some sort of compression algorithm or similar
<Smerdyakov> What programs do you write, considered over all programming languages?
<unfo-> Web-based database-driven applications is my current forté
<Smerdyakov> Then why not use OCaml for that?
<unfo-> Well because I'd prolly try to "force" OCaml to behave like an imperative language, loads of variables and modifying them etc, non-functional style. So something different - like algorithms - would be bias-free
<Smerdyakov> Interesting. I do lots of functional web programming.
<Smerdyakov> Even designed two programming languages for it. :)
<unfo-> Yeah. I am not saying it's not possible. No way. I don't know one bit of this language, so I am not sayig what it's capable of. What I *am* saying is that my mind is so filled with the current paradigms of the languages I currently use that all my decisions would be biased towards that
<unfo-> and that would prolly lead to awful design in OCaml since I would be misusing it in a way
chessguy has joined #ocaml
love-pingoo has quit ["Leaving"]
smimou has joined #ocaml
ikaros_ is now known as ikaros
<ikaros> unfo-, i got used to ocaml with a "small" math project too. my first program in ocaml was a sudoku solver.. not that good in code style but it taught me some things
<ikaros> i dont think one needs large or extremely complicated projects to get into a language.. just try to match your skill level
<unfo-> :)
delamarche has joined #ocaml
<unfo-> haha. nice! I got this one problem solved. I first did it with Ruby and it took 20sec to calculate, and with my rudimentary OCaml version it's 2.8sec :)
delamarche has quit []
delamarche has joined #ocaml
Leonidas has joined #ocaml
jajs has joined #ocaml
delamarche has quit []
danly has joined #ocaml
postalchris has joined #ocaml
flux__ has quit [Read error: 104 (Connection reset by peer)]
flux__ has joined #ocaml
Snark has quit ["Leaving"]
delamarche has joined #ocaml
ziggurat has joined #ocaml
pango has quit ["Leaving"]
pango has joined #ocaml
swater_ has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Leading Edge IRC"]
swater has quit [Read error: 60 (Operation timed out)]
_fab has quit [Read error: 60 (Operation timed out)]
_fab has joined #ocaml
swater_ has quit ["Quat"]
swater has joined #ocaml
jajs has quit [Remote closed the connection]
delamarche has quit []
<dark_light> is there anything evil in using Str.split (Str.regexp "\\(\r\n\\)+") to separe a message? because, hmm, i was using a manual function that does exactly this, but in a very ad hoc way
<dark_light> actually i was generating a ordered list with the positions of every \n, and then removing the \r using a.. regex
<dark_light> and using a loop for getting substrings..
<dbueno> What do you mean by "evil"?
delamarche has joined #ocaml
<dark_light> dbueno, a way that consumes many resources
chessguy has joined #ocaml
<flux__> dark_light, looks ok to me, except Str regexp-stuff isn't thread safe
<dark_light> flux__, what do you mean by thread safe?
<dark_light> flux__, my application is heavly thread oriented.. :(
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Leading Edge IRC"]
buluca has quit [Read error: 110 (Connection timed out)]
malc_ has joined #ocaml
postalchris has quit [Read error: 110 (Connection timed out)]
jajs has joined #ocaml
<dark_light> hi? flux__
_yak_ has joined #ocaml
<pango> dark_light: Str must use some global values, so concurrent usage can lead to incorrect results... http://caml.inria.fr/mantis/view.php?id=1625
<dark_light> pango, so i need to use PCRE?
<pango> I think PCRE is thread-safe, yes
buluca has joined #ocaml
<pango> they're alternatives (like xstr ? http://www.ocaml-programming.de/packages/) but PCRE looks like a safe choice
setog3 has quit [Remote closed the connection]
setog3 has joined #ocaml
<pango> I suppose Str would be difficult, if not impossible, to fix in a backward-compatible way, because its APi makes heavy use of hidden state
<dark_light> pango, i really don't understand, because the API i see seems almost all functional and very clear
<pango> it's not functional
<dark_light> the "api" for me is just the module signature
<malc_> dark_light: with Str. you do a match which returns nothing, then you do a group which uses hidden/static/explicit state (hidden from you), this is not thread(and otherwise) safe
<dark_light> malc_, pango said something about api, i think hidden things isn't part of api
<pango> mtStr sort-of fixes that by protecting that hidden state with mutex(es)... So at least it doesn't fall apart
<malc_> dark_light: hidden global things are
<dark_light> so what is api? for me is the things the programmers can see outside the implementation
<pango> dark_light: that hidden global state appears in the API
<dark_light> so where is the API? i am just curious to see it, i can only see the module signature plus comments
<dark_light> :>
<pango> just an example, Str.matched_string
<pango> val matched_string : string -> string
<pango> (** [matched_string s] returns the substring of [s] that was matched
<pango> by the latest {!Str.string_match}, {!Str.search_forward} or
<pango> {!Str.search_backward}.
<dark_light> ahh
<dark_light> too bad
<pango> that means that Str internally keeps track of the last regexpes search done on some strings
<pango> and use the "string addresses" as key to this internal state
<dark_light> well, i am using only global_replace and regexp.. but just for sure i will use PCRE.. (and i never used that before in ocaml..)
<malc_> just say no and use libre
<malc_> but i digress
<pango> even if mtStr makes sure that internal state never gets corrupted because of concurrent updates, that API could still go wrong if two threads attempted concurrent matching on a string
<pango> thread1: string_match on s thread2: string_match on the same s thread1: use of matched_string, get strings matched by thread2 string_match...
jajs has quit [Remote closed the connection]
malc_ has quit ["leaving"]
<pango> that looks contrived, but in large/complex programs it could happen randomly... leading to timing-dependant, hard to spot, incorrect results
ramkrsna has quit [Remote closed the connection]