gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml Meeting 2011 http://bit.ly/eaZi1C | OCaml 3.12.0 http://bit.ly/aNZBUp
ulfdoz has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
philtor has quit [Ping timeout: 246 seconds]
dnolen has joined #ocaml
andreas2 has joined #ocaml
andreas1 has quit [Ping timeout: 240 seconds]
boscop_ has quit [Ping timeout: 258 seconds]
boscop has joined #ocaml
mnabil has quit [Ping timeout: 276 seconds]
mnabil has joined #ocaml
sepp2k has quit [Quit: Leaving.]
lamawithonel has quit [Remote host closed the connection]
lopex has quit []
groovy2shoes has joined #ocaml
mnabil has quit [Ping timeout: 252 seconds]
wormphlegm has quit [Quit: leaving]
surikator has joined #ocaml
surikator has quit [Client Quit]
mnabil has joined #ocaml
groovy2shoes has quit [Read error: Connection reset by peer]
groovy2shoes has joined #ocaml
groovy2shoes has quit [Quit: groovy2shoes]
dnolen has quit [Read error: Connection reset by peer]
joewilliams is now known as joewilliams_away
dnolen has joined #ocaml
mnabil has quit [Remote host closed the connection]
vivanov has quit [Ping timeout: 260 seconds]
vivanov has joined #ocaml
eye-scuzzy has quit [Ping timeout: 260 seconds]
dnolen has quit [Quit: dnolen]
philtor has joined #ocaml
eye-scuzzy has joined #ocaml
orbitz has joined #ocaml
philtor has quit [Ping timeout: 260 seconds]
jderque has joined #ocaml
hyperboreean has quit [Ping timeout: 240 seconds]
jderque has quit [Ping timeout: 252 seconds]
jamii has joined #ocaml
ygrek has joined #ocaml
jamii has quit [Ping timeout: 276 seconds]
Yoric has joined #ocaml
jamii has joined #ocaml
waern has joined #ocaml
eye-scuzzy has quit [Read error: Operation timed out]
jamii has quit [Ping timeout: 250 seconds]
jamii has joined #ocaml
jamii has quit [Ping timeout: 276 seconds]
eikke has joined #ocaml
ftrvxmtrx has quit [Remote host closed the connection]
jderque has joined #ocaml
ftrvxmtrx has joined #ocaml
sepp2k has joined #ocaml
impy has quit [Quit: impy]
eikke has quit [Ping timeout: 276 seconds]
impy has joined #ocaml
impy has left #ocaml []
edwin has joined #ocaml
ulfdoz has quit [Ping timeout: 248 seconds]
lopex has joined #ocaml
ulfdoz has joined #ocaml
ygrek has quit [Ping timeout: 246 seconds]
jamii has joined #ocaml
DimitryKakadu has joined #ocaml
eikke has joined #ocaml
jderque has quit [Quit: leaving]
notk0 has joined #ocaml
<notk0> why does ocaml suck so much?
<adrien> camls bite, they don't suck
<notk0> adrien, ocaml does tho
asn has joined #ocaml
lopex has quit []
DOUK has joined #ocaml
asn has left #ocaml []
Smerdyakov has joined #ocaml
<DOUK> hello
<DOUK> how can i make graphs of fonctions in ocaml?
<DOUK> like i have my fonction doing its calculations and i want to make a graph of the time it took and the numbers of elements in the list it sorted
<vivanov> DOUK: you can use plplot bindings for ocaml
<DOUK> what is this
<DOUK> i see
<DOUK> is there a way to do it with gnuplot
<DOUK> oh wait plplot is free
<vivanov> indeed
<vivanov> DOUK: http://sourceforge.net/projects/ocaml-gnuplot/ looks like there are gnuplot bindings as well -- never tried that
<DOUK> i tried using this but i dont know how to use it
<vivanov> :)
<vivanov> plplot has good documentation
<DOUK> yes
<DOUK> ocaml gnuplot has very little
<vivanov> ic
jamii has quit [Ping timeout: 250 seconds]
jamii has joined #ocaml
<DOUK> can i use ocaml plplot with ubuntu?
<DOUK> http://pkgs.org/package/plplot-ocaml here i dont see ubuntu
oriba has joined #ocaml
jderque has joined #ocaml
DOUK has quit [Ping timeout: 252 seconds]
<vivanov> it's not in debian
notk0 has quit [Ping timeout: 260 seconds]
<vivanov> i guess not in ubuntu as well
<vivanov> DOUK: you can compile ocaml bindings from source -- see plplot documentation
Smerdyakov has quit [Quit: Leaving]
ygrek has joined #ocaml
* NaCl casts a gildor summoning spell
<adrien> still away during a few days
<NaCl> :(
jamii has quit [Ping timeout: 240 seconds]
douknoukem has joined #ocaml
hyperboreean has joined #ocaml
philtor has joined #ocaml
douknoukem has quit [Ping timeout: 248 seconds]
ygrek has quit [Ping timeout: 246 seconds]
douknoukem has joined #ocaml
Smerdyakov has joined #ocaml
arubin has joined #ocaml
jderque has quit [Ping timeout: 260 seconds]
jderque has joined #ocaml
bohanlon has quit [Quit: So long, and thanks for all the fish!]
DOUK has joined #ocaml
douknoukem has quit [Ping timeout: 264 seconds]
<hcarty> DOUK: Debian + Ubuntu packages may be available eventually, but for now Fedora is the only platform with pre-built PLplot + OCaml packages.
<DOUK> ok
<hcarty> All of the prerequisites are packaged for Ubuntu
<DOUK> i dont really know if i need plplot because i have to make graphs about functions and how much time they take to sort a list
<hcarty> Graph as in a series of (x, y) points, or something else?
<DOUK> i would say something else
<DOUK> i dont see how i can make a graph with a series of x,y points with what i want to do
<DOUK> basically i have to compare functions on how much time they take to sort a list
<hcarty> Functions on the x-axis, time on the y-axis could work
<hcarty> But if you only need it for this one thing then it may be easier to write the information out to a text file and plot it with gnuplot.
<hcarty> If it's something you plan to do over and over then PLplot is likely simpler in the long run.
<hcarty> With the disclosure that I'm the author/maintainer of the PLplot OCaml bindings :-)
<DOUK> well i wont be doing it over and over
<DOUK> oh wow ok
<DOUK> thanks for the help man
<hcarty> DOUK: http://plplot.sourceforge.net/examples.php?demo=12 -- this may work for what you need, but if this is a one-shot thing then writing the data to a text file and plotting it in gnuplot is likely to be simpler
<hcarty> You're quite welcome
<zorun> I agree that the simpler solution would be to output raw data
<zorun> and use gnuplot afterwards
<hcarty> The OCaml PLplot bindings have some very simple single-line functions for point, line and contour plots. Nothing for bar charts though.
<zorun> are you able to choose the output format?
<zorun> I mean, svg, pdf...
<hcarty> zorun: Yes
<zorun> nice
<hcarty> png, svg, pdf, ps, X, Cairo surface, and a few others
myst has joined #ocaml
philtor has quit [Ping timeout: 252 seconds]
myst has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
Smerdyakov has quit [Quit: Leaving]
Vinnipeg has joined #ocaml
Vinnipeg has quit [Remote host closed the connection]
avsm has joined #ocaml
avsm has quit [Client Quit]
avsm has joined #ocaml
tautologico has joined #ocaml
DOUK has quit [Ping timeout: 250 seconds]
douknoukem has joined #ocaml
dnolen has joined #ocaml
lopex has joined #ocaml
happy4crazy has joined #ocaml
iris1 has joined #ocaml
robinnn has joined #ocaml
robinn has joined #ocaml
robinnn has quit [Remote host closed the connection]
Egbert9e9 has joined #ocaml
DOUK has joined #ocaml
douknoukem has quit [Ping timeout: 240 seconds]
wagle has quit [Read error: Connection reset by peer]
wagle has joined #ocaml
undecidable has joined #ocaml
Associat0r has quit [Read error: Connection reset by peer]
Associat0r has joined #ocaml
<DOUK> hey
<DOUK> anyone can help me with a list problem
<DOUK> so i have a list and i have to remove doubles
<DOUK> my problem is that i fail to apply that function to the rest of the list
<DOUK> just for the first element
wagle has quit [Remote host closed the connection]
<DOUK> i fail somewhere in the recursive
dnolen has quit [Quit: dnolen]
<iris1> You seem to have at least two problems with this code
<iris1> 1. the recursive call to killdoubles_bis uses a instead of x
<iris1> 2. the call from killdoubles to killdoubles_bis is structured so as to drop the first element, no matter if it's a double or not
<DOUK> yes when i use x instead of a in the recursive call
<DOUK> only the first element drops
tautologico has quit [Quit: tautologico]
<iris1> My recommendation would be to scratch this code and start again, with a pattern match that looks at [], [x], x::y::r separately. That would probably lead to better code.
<DOUK> ok
mnabil has joined #ocaml
lopex has quit [Ping timeout: 260 seconds]
jderque has quit [Quit: leaving]
Associat0r has quit [Read error: Connection reset by peer]
olauzon has joined #ocaml
lopex has joined #ocaml
Associat0r has joined #ocaml
undecidable has quit [Quit: Leaving]
<DOUK> well the function is about removing elements that appear more than once in the list
<DOUK> so i can have a list of unique elements in the end
<happy4crazy> one way would be to scan through the list and place each "new" element into a list of the unique elements
<happy4crazy> at the end, you return the constructed list of uniques
<DOUK> thats what i tried to do with the first function but i failed
<DOUK> oh wait
<DOUK> i see now
olauzon has quit [Quit: olauzon]
DimitryKakadu has quit [Remote host closed the connection]
robinn has quit [Quit: Leaving]
mnabil has quit [Ping timeout: 252 seconds]
mnabil has joined #ocaml
Yoric has quit [Quit: Yoric]
DOUK has quit [Ping timeout: 252 seconds]
douknoukem has joined #ocaml
edwin has quit [Remote host closed the connection]
<douknoukem> hey so i tried to make that function
<douknoukem> but i fail
<douknoukem> i am doing the tests two by two
<douknoukem> and i dont know how i can take the current first element then test it with the tail
<douknoukem> then delete that element and add it to a new list
<douknoukem> and repeat untill list is empty
Egbert9e9 has left #ocaml []
<happy4crazy> in pseudo code, here's how i would do it
<happy4crazy> is it ok if i give a pseudo-code solution?
<happy4crazy> or do you want to keep strugglign with it :)
<douknoukem> i feel like i wont move a inch if i keep going
<happy4crazy> ok, that's fair :)
<happy4crazy> 1 sec
<zorun> from a theorical point of view, it is very similar to a sort
<zorun> as such, while the easiest solution would be in n², you could do it in n*log(n)
<happy4crazy> sorry for the delay, i wanted to code it up first and i'm used to haskell :)
<douknoukem> no problem
<happy4crazy> given a list
<happy4crazy> pattern match it against []
<happy4crazy> or x :: xs
<happy4crazy> if the list is empty, then the uniques are empty as well
<happy4crazy> if it looks like x :: xs
<happy4crazy> then check to see if x is already contained in the currently accumulated uniques
<happy4crazy> if so, don't add x to the uniques, since it's already in there
<happy4crazy> if not, then it's a new unique, so cons it onto the front
<happy4crazy> and recurse on the rest of the list, the xs
<happy4crazy> hmm, this is harder to read in pseudocode than in actual code :/
<douknoukem> well
<douknoukem> i dont know how to set the new value to test
<douknoukem> then check to see if x is already contained in the currently accumulated uniques
<happy4crazy> here, i'll just post the code, it's easier to read
wagle has joined #ocaml
wagle has quit [Read error: Connection reset by peer]
<happy4crazy> this is one way, but as zorun suggests you can do it better
<happy4crazy> the first function checks if x is an element of xs
<happy4crazy> the second one finds uniques
<douknoukem> ok thanks man
<happy4crazy> does the code make sense?
wagle has joined #ocaml
wagle has quit [Read error: Connection reset by peer]
<douknoukem> yes
<douknoukem> wait
<douknoukem> what is helper
<happy4crazy> an example might help
<happy4crazy> say the list is [1; 1; 2; 2;]
<happy4crazy> and consider the helper function
boscop_ has joined #ocaml
<happy4crazy> it pattern matches the list, so x -> 1, xs -> [1; 2; 2]
<happy4crazy> initially, acc is []
<happy4crazy> acc will hold all of the uniques
<happy4crazy> next we check if x is an element of acc
<happy4crazy> acc is empty, so we add 1 to acc
<happy4crazy> and recurse on the rest of the list, [1; 2; 2]
<happy4crazy> now x is 1
<happy4crazy> and xs is [2; 2]
<happy4crazy> and acc is [1]
<happy4crazy> 1 is already an element of acc, so don't add it to acc
<happy4crazy> and then recurse
<happy4crazy> we pattern match again on [2; 2]
<happy4crazy> x -> 2
<douknoukem> ok
boscop has quit [Ping timeout: 250 seconds]
<douknoukem> thanks a lot
<happy4crazy> sure
<zorun> pretty nice solution
<happy4crazy> at the very end, I reverse the accumulated list, so it's in the right order
<zorun> still in n^2, though ;)
<happy4crazy> heh :)
<happy4crazy> i actually hadn't thought about an n log n solution for uniques before
<zorun> I'm almost done with a variant of merge sort
<happy4crazy> yeah
boscop_ has quit [Read error: Connection reset by peer]
<douknoukem> so elem x xs tests if x = y
<douknoukem> if not it keeps looking in the list right
boscop_ has joined #ocaml
<happy4crazy> in words, x is an element of xs if it's equal to the first element of xs, or if it's an element of the rest of xs
wagle has joined #ocaml
<douknoukem> ok
eikke has quit [Ping timeout: 246 seconds]
<zorun> in fact, it is a pretty standard merge sort: you first split the list recursively in two lists
boscop_ is now known as boscop
<zorun> when you have 1 element, it is sorted
<zorun> and then you merge back all of your little lists
<zorun> the key is to eliminate duplicates while merging
<happy4crazy> argh, you beat me :)
<zorun> (the `compare h1 h2' part)
<zorun> really? :)
<douknoukem> compare is a function of comparison right
<happy4crazy> heh i'm new to ocaml, and keep typing haskell instead :/
<douknoukem> you put < or > or another comparator
<zorun> I've always wanted to try haskell out...
<zorun> an friend that was once an ocaml-freak now seems to enjoy haskell a lot :)
<happy4crazy> haskell is very fun
<happy4crazy> i'm fairly new to functional programming, and it definitely has a slicker marketing dept than ocaml
<happy4crazy> but lately i've been following CMU's new intro programming class
<zorun> douknoukem: "compare a b" returns -1 if a<b, 1 if a>b, and 0 if a=b, but it works for int, float, string, ...
<happy4crazy> which uses ml
<douknoukem> ok
<zorun> CMU?
<happy4crazy> carnegie mellon
<happy4crazy> the prof has a very fun blog: existentialtype.wordpress.com
<zorun> oh, I see
<zorun> the name is fun by itself :p
<happy4crazy> actually, not to spam, but i'm experimenting with writing a blog too :)
<happy4crazy> monastic.io
<happy4crazy> probably mostly haskell stuff, but maybe ocaml too
oriba has quit [Quit: Verlassend]
<zorun> wow, nice work
<zorun> I mean, the blog itself
<happy4crazy> thank you
<happy4crazy> also, i like your merge sort--mine is not nearly as nice looking
<zorun> I've been looking for a way to have a simple architecture for my blog, allowing to write articles in markdown and pushing them via git
<happy4crazy> i'm using jekyll
<zorun> well, you did it
<zorun> ruby ?
<happy4crazy> here's how i did it
<happy4crazy> basically, you create a github repository
<happy4crazy> and github will host it for you
<happy4crazy> so git push etc. works really smoothly
<happy4crazy> they run everything through jekyll behind the scenes
<happy4crazy> i think
<happy4crazy> i've just started it, so i'm still working out kinks etc.
<zorun> nice
<zorun> I didn't know github was providing such a service
<zorun> anyway, I fell back to a wordpress blog ...
<happy4crazy> what's your blog?
<happy4crazy> gotta run out for a bit
<douknoukem> hey so there is this functino that returns the minimum of a list http://pastebin.com/pYAwMd3L
<douknoukem> problem is
<douknoukem> for the first go i dont see what value m takes
<douknoukem> so it can compare to the first element of the list
<zorun> happy4crazy: blog.invokk.net
Amorphous has quit [Read error: Connection reset by peer]
<zorun> but I believe you'll be the first real visitor, I just made it public today :)
<zorun> running? it's 1am here :p
<douknoukem> and i dont understand this part here" else min_list_bis r m in match l with [] -> failwith "min_list" | x::r -> min_list_bis r x ;; "
<douknoukem> is it to give m the value of the current element of the list
<zorun> well, m is the current min of the list
<zorun> so, at first, you just initialize it with the first element of the list
<douknoukem> but when does it do it
<zorun> from line 2 to 7, it's actually a function definition
<zorun> so it only gets executed when you call it on line 10
<douknoukem> that is strange
<douknoukem> so the initialisation is after the in?
<zorun> yes
<douknoukem> and the part inside of the in is from line 2 to 7
<zorun> let rec min_list_bis l m = <function definition> in ...
<zorun> it's a definition, nothing more
<douknoukem> i thought only else min_list_bis r m was inside in
<douknoukem> ok
<zorun> you could even move line 2 to 7 to the top, outside of the min_list function
<zorun> although this is bad style, I think
<douknoukem> yes thats what i do when i make a _bis function
<douknoukem> is it better with in
<zorun> happy4crazy: what is that : " partition <- parts (xs \\ anchor)"
<zorun> are you doing, like, the substraction of two lists?
impy has joined #ocaml
<zorun> I'm so tired... it's getting pretty late an hour for a french guy
<zorun> hope to see you soon
ymasory has joined #ocaml
<douknoukem> yes
Smerdyakov has joined #ocaml
<happy4crazy> zorun: yes, that's list subtraction
<happy4crazy> it's defined in the Data.List module
<happy4crazy> so 'import Data.List' to make it work
<happy4crazy> or ':m + Data.List' in the repl
<happy4crazy> zorun: ok gotta run, i'll check out the blog :)
Amorphous has joined #ocaml
Smerdyakov has quit [Quit: Leaving]
dnolen has joined #ocaml
douknoukem has quit [Ping timeout: 250 seconds]
ulfdoz_ has joined #ocaml