flux__ 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/
smimou has quit ["bli"]
chessguy has joined #ocaml
chessguy has quit [" Try HydraIRC -> http://www.hydrairc.com <-"]
chessguy has joined #ocaml
<chessguy> i'm confused. what's the relationship between OCaml and ML?
<ketty> OCaml is a dialect of ML
<ketty> SML is another common dialect of ML
<chessguy> SML...the parent of HTML and XML?
<ketty> no :)
<ketty> thats SGML, right?
<chessguy> ugh, too many acronyms
<chessguy> oh yes, of course, sorry
<ketty> SML stands for Standard-ML
<chessguy> so...if you knew ML, you'd basically know SML and OCaml?
<ketty> well.. sort of..
<zmdkrbou> "ML" is used as a generic term for this kind of functional languages
stas has quit ["Leaving"]
<chessguy> aha. so ML isn't really a language to be learned
<zmdkrbou> it exists, but when people say "ML" they don't always refer to this one particular language
<chessguy> ok
<zmdkrbou> SML is what ML has become
<chessguy> i'm curious about all this because it seems like all of a sudden everywhere i look i run into OCaml
<ketty> chessguy: then it's time to learn it ;)
<chessguy> i'm thinking so
<zmdkrbou> probably a sign :p
<chessguy> how does OCaml compare to lisp? besides the lack of parentheses? i guess lisp is a more pure functional language?
<zmdkrbou> eer, i'm not a lisp guy but i would say no
<dylan> ocaml is statically typed.
<zmdkrbou> lisp isn't really clean ...
<dylan> and lisp is also... well, common lisp has more imperative features.
<chessguy> i have no idea what static typing is
<zmdkrbou> it means you can tell the type of any expression at compilation time
<dylan> chessguy: wikipedia is your friend. :)
<chessguy> ok
<chessguy> as opposed to?
<zmdkrbou> dynamic typing
<ketty> chessguy: but the neat thing is that types are automatically infered :)
<zmdkrbou> yep, languages like C are statically type but that's not so hard since you have to write down the types in the code :)
<zmdkrbou> typed*
<chessguy> oy. looks like i'm gonna need the principles of programming languages class i'm taking in the fall
<chessguy> ok, so for instance, perl has dynamic typing, right?
<zmdkrbou> yes
<chessguy> cha-ching! score one for the n00b
<chessguy> so...uh...is static typing a good thing?
<zmdkrbou> very good yes
<chessguy> ok, i'll bite. why?
<zmdkrbou> if you apply a function which should take an integer argument to a string, you get crashed ok ?
<chessguy> sure
<dylan> static typing makes the program certifiably correct, rather than making the programmer certifiably insane.
<chessguy> lol
<chessguy> i'll have to remember that one :)
<zmdkrbou> if your program is statically typechecked, you can't apply the function to the wrong type of arguments
<chessguy> oh ok, so more errors caught at compile time
<dylan> chessguy: Bingo.
<zmdkrbou> many many more yes :)
<zmdkrbou> the good thing is type inference (static typing is a widespread feature)
<zmdkrbou> in C you write "int n = 3;" but in ocaml you write "let n = 3" and the compiler can work out himself the fact that 3 is an integer
<chessguy> let?? wow, that's a keyword i haven't seen in a long time
<zmdkrbou> (how smart guy he is, this compiler ;p)
* chessguy has flashbacks to GW-BASIC
* zmdkrbou doesn't know GW-BASIC
<chessguy> count your blessings
<zmdkrbou> hehe
<chessguy> Dijkstra was known to say that once a programmer had learned Basic, there was no more hope for him
<zmdkrbou> ML is basically let x = bla in blablabla
<chessguy> so...if i'm going to break into this family of languages, where do you guys recommend i start? with OCaml, or SML, or ML, or what?
<zmdkrbou> ML is dead
* zmdkrbou would say ocaml :p
<chessguy> i guess that's kind of a silly question to ask in #OCaml, eh?
<zmdkrbou> boarf, i think there may be some SML guys here
<zmdkrbou> quite close languages :)
<dylan> Smerdyakov would be one of the SML folk.
<zmdkrbou> i suppose people in the US are easily SML-oriented
<dylan> Not me! :)
<zmdkrbou> :)
<chessguy> i don't know. looking at http://www.ps.uni-sb.de/~rossberg/SMLvsOcaml.html they both seem to have their peculiarities
<dylan> Especially because of the syntax for guards on patterns.
<dylan> SML seems to have more ways of defining symbols.
<dylan> and, there is the whole bit about ocaml targeting my architecture, and the fastest SML compiler not...
<zmdkrbou> :)
<zmdkrbou> chessguy: this is mainly syntax differences
<zmdkrbou> look at the languages features
<zmdkrbou> it's the ML style
<chessguy> ok, so what's the difference between the language features of SML and OCaml?
<zmdkrbou> approximatively nothing :)
* zmdkrbou invokes someone who really know SML
<zmdkrbou> +s
<chessguy> apparently there is no such person in the channel at the moment
<chessguy> anyway, thanks for answering a n00b's questions. i'm sure i'll have more down the road :)
<zmdkrbou> cool :)
<zmdkrbou> about the starting thing, i'd say look at what you need to work on ...
<zmdkrbou> i mean there are "ocaml places" and "SML places" ...
<chessguy> i'm still not sure which way i should go, though it probably doesn't matter much in the long run
mikeX has joined #ocaml
<zmdkrbou> yep ... but if everybody around you uses SML then maybe do the same (and the other way if ocaml)
<chessguy> i haven't heard of anyone i know using either, but i've heard the name ocaml come up more
<zmdkrbou> cool thing :) </zealot>
<chessguy> :)
<zmdkrbou> and now : sleep time
<zmdkrbou> good night here
<chessguy> g'night
descender has quit [Remote closed the connection]
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- Leading Edge IRC"]
descender has joined #ocaml
mikeX has quit ["zzz"]
chessguy has joined #ocaml
<chessguy> i'm not sure i've wrapped my mind around the idea of functional programming yet
<chessguy> it seems to me it requires a completely different way of thinking about programming, though i could be wrong
m3ga has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- 100,000+ downloads can't be wrong"]
m3ga has quit ["disappearing into the sunset"]
JKnecht has joined #ocaml
ski has quit [Read error: 104 (Connection reset by peer)]
Smerdyakov has quit ["Leaving"]
ski has joined #ocaml
cfkklwww has joined #ocaml
cfkklwww has left #ocaml []
m3ga has joined #ocaml
khaladan has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
love-pingoo has joined #ocaml
Revision17 has joined #ocaml
revision17_ has quit [Read error: 110 (Connection timed out)]
Skal has joined #ocaml
Schmurtz has joined #ocaml
slipstream has joined #ocaml
permanente is now known as profmakx
slipstream-- has quit [Read error: 110 (Connection timed out)]
rillig has joined #ocaml
mikeX has joined #ocaml
smimou has joined #ocaml
Bigb[a]ng is now known as Bigbang
_JusSx_ has joined #ocaml
ramki has quit [Read error: 110 (Connection timed out)]
<_JusSx_> hi ocaml ppl
<ketty> hello _JusSx_
mikeX has quit ["bye"]
<love-pingoo> is there a way to group without naming with OCaml's standard regexps (Str) ?
<pango> if there is, it's not documented
<ketty> hey, do people consider ocaml to be good or bad to write gui in?
<love-pingoo> I couldn't give a good advice
<love-pingoo> BUT I HATE OCAML REGEXPS
<love-pingoo> actually I only wrote one simple gui in OCaml, all I can say is that lablgtk is poorly documented
<love-pingoo> I was much more productive with pyGtk, despite the problems inherent to python
<ketty> i am currently translating a gtk2-gui written in C into ocaml/lablgtk2...
<ketty> at least, compared to C lablgtk2 rokks :)
Smerdyakov has joined #ocaml
<love-pingoo> let re = Str.regexp "\\(a\\(a+\\)a\\|\\(\\(b+\\)\\)\\)"
<love-pingoo> Str.string_match re "bb" 0
<love-pingoo> and the matched_groups are ... [(1, "bb"); (0, "bb")]
<flux__> love-pingoo, btw, there is a cool module for pcre that allows you to write regular expression matches much more neatly..
<love-pingoo> whereas I explicitely put an extra grouping to get my result in \2 in either cases
<love-pingoo> flux__: I know but I'd like to avoid the dependency, since I need only a small (but tricky) function
<flux__> go for the dependency ;)
<flux__> just to give an idea to others who may not be familiar with it: let separate s = Regexp.match s with | "^(.*/)?([^/]*?)(\.[^.]*)?$" as dir, file, extension -> coalesce [dir; Some ""], file, coalesce [extension; Some ""] | _ -> raise (Invalid s)
<flux__> (separates a file name into path, name and extension)
<flux__> ((coalesce is a function that returns the first Some of given list unoptionified))
<ketty> dont you have to do "\\." instead of "\." ?
<flux__> I'm pretty sure that has worked :)
<flux__> the failure should be pretty evident :)
<ketty> # "\.";;
<ketty> Warning X: illegal backslash escape in string.
<ketty> you don't get that?
<flux__> it's a language extension
<flux__> it can override some rules
<ketty> nice :)
<pango> love-pingoo: groups are numbered after their position in the regexp, not after the "patch" that led to the successful match
<pango> s/patch/path/
<pango> # Str.matched_group 3 s ;;
<pango> - : string = "bb"
<pango> # Str.matched_group 4 s ;;
<pango> - : string = "bb"
<love-pingoo> pango: in my case the first group was "bb"
<love-pingoo> which isn't consistent with your explanation
<pango> I don't know what group #0 is
<love-pingoo> I'm afraid the behaviour isn't consistent with anything :p
<love-pingoo> pango: 0 is for the whole matched string
<pango> ok
<pango> then group #n is the group that starts with the nth \( in the regexp
<love-pingoo> # let re = Str.regexp "\\(a\\(a+\\)a\\|\\(\\(b+\\)\\)\\)" ;;
<love-pingoo> val re : Str.regexp = <abstr>
<love-pingoo> # Str.string_match re "bb" 0 ;;
<love-pingoo> - : bool = true
<love-pingoo> # Str.matched_group 1 "bb" ;;
<love-pingoo> - : string = "bb"
<love-pingoo> # Str.matched_group 2 "bb" ;;
<love-pingoo> Exception: Not_found.
<love-pingoo> # Str.matched_group 3 "bb" ;;
<love-pingoo> - : string = "bb"
<love-pingoo> # Str.matched_group 4 "bb" ;;
<love-pingoo> - : string = "bb"
<love-pingoo> ...sorry for the flood
<flux__> just avoid the Str-module, it's evil ;(
<love-pingoo> pango: you're right, except that the first group should be "" or Not_found
<flux__> I've been bitten twice by it
<love-pingoo> flux__: I'd expect it to be heavy and un-convenient
<love-pingoo> but it's even inconsistent :(
<love-pingoo> :))
<pango> the first group is the same as the group 0, since you embedded your whole regexp in a group
<flux__> once by the fact that it uses global state and once by that the functions that seem like thread-safe, aren't
<love-pingoo> pango: oops, sorry, I had forgotten the external group !
<love-pingoo> shame on me
<love-pingoo> the non-thread-safe issue will eventually bit me too :(
<flux__> and it's a devil to find, too
<flux__> fortunately I ran the software with OCAMLRUNPARAM=b
<flux__> and noticed the problem of a thread dying
<love-pingoo> you were lucky that it died
<love-pingoo> could have kept running with a faulty match
<flux__> yeah
<pango> flux__: did you report the bug ? At very least, there should be a warning in the doc
<pango> the problem is that it's a design error :/
piggybox has quit [" HydraIRC -> http://www.hydrairc.com <- IRC for those that like to be different"]
khaladan has quit [Read error: 104 (Connection reset by peer)]
Tachyon76 has joined #ocaml
<love-pingoo> ok I give up
<love-pingoo> what's the wonderful URL for ocaml regexps ?
<love-pingoo> should I go for the camlp4 extension or the pcre lib ?
* ketty is allready hooked by the camlp4 extension without ever using it :)
piggybox has joined #ocaml
<zmdkrbou> love-pingoo: pcre is probably easiest for you :)
<love-pingoo> I think so, I don't want to make the building of liquidsoap too heavy
<love-pingoo> bothering with camlp4 params in my makefile system, and so on
<love-pingoo> but of course the gentoo package for pcre-ocaml is late :(
<ketty> you could allways use godi...
Schmurtz has quit [Read error: 113 (No route to host)]
<love-pingoo> that's right, but I still have got very much into that yet
* ketty very much like godi :)
<love-pingoo> I made a parallel installation of some ocaml packages using godi, them more or less forgot about them
Tachyon76 has quit ["Leaving"]
<zmdkrbou> mattam: ping
<ulfdoz> apropos parallelism: Is there any support for distributed/parallel computing in ocaml?
<ulfdoz> Or is everything to do by hand (locking, communication, scheduling)....
<smimou> theres a biding for mpi I think
<smimou> +'+n
<ulfdoz> C with mpi sucks. If it compiles it usually doesn't run well or long or is simply buggy. ;)
<pango> jocaml ?
<ulfdoz> I remember spending several hours on finding the node, which caused the segfault (was a hpc-line cluster and the error didn't occur with 4 or less nodes).
<smimou> pango: jocaml is quite dead for now
<Smerdyakov> ulfdoz, you can use Concurrent ML (Event module) to provide a good interface for distributed operations.
<pango> yes, I know
<smimou> but I think there's some kind of underground revival
<smimou> I've seen some postdoc job offers to make an up-to-date version of jocaml
<ulfdoz> cool, even part of sml.
permanente has joined #ocaml
chessguy has joined #ocaml
<ketty> using Obj.magic () as a dummy value when you are prototyping is a very bad idea =)
<pango> yes, it sometimes fizzles
profmakx has quit [Read error: 113 (No route to host)]
<chessguy> would it be fair to say that functional programming supports a more top-down approach than, say, imperative programming?
<pango> top-down sucks
<chessguy> that's not quite what i asked, but what would you prefer?
<pango> bottom-up, that usually helps writing reusable code
<ketty> chessguy: functional programming helps you to abstract away everything that's not important.
<chessguy> how?
<chessguy> sorry, i'm still trying to get my mind around the necessary change in thinking to do functional programming
<ketty> it makes it very easy to write abstract data types..
<ketty> so instead of manipulating concrete data
<ketty> you deal with more abstract data...
<ketty> and you can define how it is manipulated in an abstract way :)
<chessguy> ok, that makes sense
<pango> chessguy: Reading http://mitpress.mit.edu/sicp/ could help
<chessguy> i guess i just don't know how i need to think differently about problems to solve them in an FP
<chessguy> ...language
<chessguy> let me look
<pango> IIRC the examples are in scheme, but most ideas map to any functional language
<chessguy> looks like an interesting book. thanks for the link
<mattam> zmdkrbou: pong
<zmdkrbou> mattam: coqide is broken in gentoo, i just wanted to know if you were aware of the problem
Schmurtz has joined #ocaml
<zmdkrbou> (problem with lablgtk in fact)
<mattam> what's the bug ?
<mattam> no i was not aware of it
<zmdkrbou> The files /usr/lib/ocaml/threads/thread.cmi
<zmdkrbou> and /usr/lib/ocaml/lablgtk2/gtkThread.cmi make inconsistent assumptions
<zmdkrbou> over interface Thread
<zmdkrbou> :s
<mattam> ok, reemerge lablgtk2
<zmdkrbou> already done :\
<mattam> sure you didn't rebuild lablgtk ?
<zmdkrbou> nothing to merge :\
<mattam> did you run the ocaml-rebuild script ?
<zmdkrbou> ouhla, what's this ? :)
<mattam> a script to avoid such errors :)
<zmdkrbou> hehe, i wish i had this
<zmdkrbou> /usr/portage/dev-lang/ocaml/files/ocaml-rebuild.sh << ok i have this
<zmdkrbou> why isn't this used when emerging ?
<mattam> basically each time you merge ocaml you must rebuild every library as it breaks binary compatibility
<mattam> you might now better than me :)
<mattam> know
<mattam> another answer is 'it will be done someday'
<zmdkrbou> yep but i'm surprised that emerge doesn't take care of binary compatibility (it should not tell me lablgtk is ok)
<zmdkrbou> oh, ok :)
<zmdkrbou> you're still the one in charge of this ?
<mattam> the fact is in case of C it is no problem (usually)
<mattam> of the ocaml ebuild yes
<mattam> there is actually something similar to ocaml-rebuild for python, maybe other compilers too
finelemon has quit [Read error: 110 (Connection timed out)]
finelemon has joined #ocaml
chessguy has quit [" HydraIRC -> http://www.hydrairc.com <- State of the art IRC"]
permanente has quit ["Reconnecting"]
profmakx has joined #ocaml
finelemo1 has joined #ocaml
finelemon has quit [Read error: 110 (Connection timed out)]
lispy has joined #ocaml
lispy has quit [Remote closed the connection]
chessguy has joined #ocaml
mikeX has joined #ocaml
<love-pingoo> anybody remembering those float_of_string problems with locales ?
<love-pingoo> I cannot get float_of_string to parse floats the french way using LC_NUMERIC. Has it been re-implemented locale independent ?
<smimou> love-pingoo: if it helps, float_of_string seems to ba a call to strtod
<smimou> from the man
<smimou> A decimal number consists of a nonempty sequence of decimal digits possibly containing a radix char-
<smimou> acter (decimal point, locale dependent, usually ``.'')
<smimou> so with a french LC_NUMERIC, the separator should be a "," I guess
<ketty> if not LC_NUMERIC is overridden in some weird place :)
<love-pingoo> something like that probably happens, cause I did try setting LC_NUMERIC
Schmurtz has quit ["Dodo !"]
Schmurtz has joined #ocaml
CHodapp has joined #ocaml
Bigbang is now known as Bigb[a]ng
profmakx has quit ["Lost terminal"]
profmakx has joined #ocaml
Skal has quit [Remote closed the connection]
_JusSx_ has quit ["leaving"]
bzzbzz_ has joined #ocaml
bzzbzz has quit [Read error: 110 (Connection timed out)]