Banana changed the topic of #ocaml to: OCaml 3.08 "Bastille Day" Release available ! -- Archive of Caml Weekly News: http://pauillac.inria.fr/~aschmitt/cwn , A tutorial: http://merjis.com/richj/computers/ocaml/tutorial/ , A free book: http://cristal.inria.fr/~remy/cours/appsem, Mailing List (best ml ever for any computer language): http://caml.inria.fr/bin/wilma/caml-list
vezenchio has quit ["With little power comes little responsibility"]
kinners has joined #ocaml
kinners_ has joined #ocaml
kinners has quit [Read error: 60 (Operation timed out)]
tautologico has joined #ocaml
gl has left #ocaml []
yauz_ has joined #ocaml
yauz has quit [Read error: 110 (Connection timed out)]
FredCods_ has joined #ocaml
FredCods has quit [Read error: 110 (Connection timed out)]
monotonom has quit ["Don't talk to those who talk to themselves."]
kinners_ has quit [Read error: 110 (Connection timed out)]
mrsolo has joined #ocaml
avn has quit [niven.freenode.net irc.freenode.net]
avn has joined #ocaml
jason_ has joined #ocaml
Smerdyakov has quit [Remote closed the connection]
Smerdyakov has joined #ocaml
avn has quit [niven.freenode.net irc.freenode.net]
avn has joined #ocaml
cjohnson has quit [Read error: 110 (Connection timed out)]
kosmikus1away has joined #ocaml
tautologico has quit ["Leaving"]
kosmikus|away has quit [Read error: 104 (Connection reset by peer)]
Herrchen_ has joined #ocaml
Herrchen has quit [Read error: 110 (Connection timed out)]
jdrake has joined #ocaml
<jdrake> what is this 3.08 thing?
<jdrake> not website mention of it
<ofranja> go to the 'ocaml distribution' link.
<jdrake> ah
<det> jdrake: ocaml.org is not the website
<det> jdrake: out of date, fan page
<jdrake> that is always where I go because of its ease of remembering
<Riastradh> Has any official OCaml person contacted the owner of ocaml.org to see if it could be brought up to date & maintained by someone relevant?
<det> there was a thread on ocaml-list
<jdrake> another thing would be for them to configure www as the default for absence of subdomain, because ocaml.org goes different than www.ocaml.org
<jdrake> "In large part, the purpose of such a site should be to convey that ocaml is a living, breathing animal. But the frozen newsfeed on the site will most definitely achieve the opposite effect " hmm exactly what I have been thinking whenever going there
<det> msot importantly
GreyLensman has quit ["Leaving"]
<jdrake> sounds good and a quick look at 3.08 looks good
<jdrake> if I had somethings installed with 3.07, will i have to recompile those?
<jdrake> are there any scripting languages implemented with ocaml?
<ofranja> jdrake: it depends. but usually, yes.
<ofranja> jdrake: when upgrading from 3.07 to 3.07p2, i had some problems using previous installed libraries.
<jdrake> i will probably have to clean out my ocaml dir and reinstall the pkg i downloaded
<jdrake> hmm, how do you copy and paste in xterm? I tried selecting and using middle button, but it isn't doing anything
debona|r has joined #ocaml
<demitar_> jdrake, perhaps you're using an editor which uses the mouse for it's own purposes? C-k and C-y is the way for most things.
<debona|r> heh
<det> try holding shift while you select?
Smerdyakov has quit [niven.freenode.net irc.freenode.net]
<debona|r> ok, so I wrote a lil power function
<debona|r> can someone show me some different ways of writing the same thing?
<debona|r> pointers?
Smerdyakov has joined #ocaml
<debona|r> hey Smerdyakov
<jdrake> ah, figured it out: select as normal, but hold option and left click to paste
<jdrake> debona|r, i can just once i figure out how to express it
<debona|r> jdrake: what do you mean? 2 to the power of 3 ... 2 * 2 * 2
<jdrake> where is a list of math functions
<debona|r> I wanted to write it on my own... just to use iteration etc
<jdrake> oh i see
<jdrake> either way, what is the equivalent function for ln?
<debona|r> but that said, I was wanting someone with more experience to tell me how it could be made better
<jdrake> i can't find it anywhere
<debona|r> or different even
<jdrake> you know the relationship between exp / ln and the operation x ^ y right?
<debona|r> i'm not sure I should claim to know anything :P
<debona|r> but mathematically, sure
<debona|r> although it's been awhile
Naked has joined #ocaml
<jdrake> let ( ^. ) x y = exp (y *. log x);;
<jdrake> not that it works exactly
<jdrake> but as close as I guess it could come: # 2.0 ^. 3.0;;
<jdrake> - : float = 7.99999999999999822
<jdrake> here we go :-) let ( ^ ) x y = int_of_float (exp (float_of_int x) *. log (float_of_int y) );;
<jdrake> quite ugly
Hadaka has quit [Read error: 111 (Connection refused)]
Naked is now known as Hadaka
<ofranja> these 'x_of_y' functions are the ugliest.
<ofranja> not to mention that, if you're implementing a 'to_string' function, they usually take a lot of lines of code.
wmg has joined #ocaml
<debona|r> I think I like my method better :P
<debona|r> course, my returned 16
<debona|r> which is really 2^4
<debona|r> hm
<debona|r> it doesn't actually even do what I wanted
<debona|r> doh
<debona|r> haha
wmg has left #ocaml []
<debona|r> ok, bedtime
not_me2 has quit [Remote closed the connection]
not_me2 has joined #ocaml
Snark has joined #ocaml
Lemmih_ has joined #ocaml
ita has joined #ocaml
<ita> hi all
<ofranja> ppl, i'm having a problem concerning Unix.create_process. it opens the process but doesn't exit when process terminates.
<ofranja> i'm passing /usr/bin/true as the program to run, and tried with various file_descr: /dev/null, /dev/zero and standard in/out/err.
<ita> ofranja: keep trying while keeping an eye on the doc, i'm sure you'll manage to find a solution :)
<ofranja> actually, let me correct myself: *the process* doesn't exits. since /bin/true just exit with a zero status code, it should.
<ofranja> well, it's not a documentation issue, i guess. this only happens when i open more than one child.
<ofranja> with just one child open, everything runs fine.
ita has quit ["Lost terminal"]
<ofranja> a quick look at 'ps', shows the various 'ocamlrun' processes that haven't returned. and they aren't zombies.
<mflux> ofranja, you need to 'wait' (or 'waitpid') for the process to get rid of the zombie, which holds the return value of the process
<ofranja> yes, that's the point. waitpid doesn't return the processes.
<mflux> doesn't return?
<ofranja> yes.
<ofranja> i even got one Unix.Unix_error(ECHLD,_,_) exception after 3 childs returned. but i have opened 15.
<ofranja> i've reimplemented this part of the code as a test program, but i can't find out the problem.
<mflux> let devnull_in = Unix.openfile "/dev/null" [Unix.O_RDONLY] 0 and devnull_out = Unix.openfile "/dev/null" [Unix.O_WRONLY] 0 and process = Unix.create_process "/bin/true" [||] devnull_in devnull_out devnull_out;; and then Unix.waitpid [] process;; works for me
<ofranja> it's just one process.
<ofranja> one process is fine.
<mflux> so the problem appears only with many processes?
ita has joined #ocaml
<ofranja> yes.
<ita> grr fsc#*! connection
<mflux> short or long-lived?
<ofranja> very short.
<ofranja> /usr/bin/true
<ita> ofranja: add flush_all ();; (one never knows, it solved my all my problems yesterday :)
<ofranja> didn't change a bit.
<ofranja> 17373 pts/21 R 0:12 /usr/bin/ocamlrun ./t
<ofranja> there are ~6 like this one running.
<mflux> let's say I have:
<mflux> let rec processes n = if n > 0 then (Unix.create_process "/bin/true" [||] devnull_in devnull_out devnull_out)::(processes (n - 1)) else [];;
<mflux> let wait l = List.map ( fun p -> (Unix.waitpid [] p)) l;;
<ofranja> funny. kill -TERM doesn't seem to affect them.
<mflux> this works: wait (processes 20);;
<mflux> are they zombies?
<ofranja> nope.
<ofranja> very strange.
jason_ has quit ["Client Exiting"]
<ofranja> but you are doing it another way.
<ofranja> i'm calling waipid with [ WNOHANG ] and -1 as arguments.
<mflux> are you sure you're not calling it too soon?
<mflux> so if you have 20 processes and you call it 20 times, but for the first call the first process has not yet exited
<ofranja> yes, like this. actually, the program in question open a bunch of processes, then, it gets the pids that are no longer running (that's why the "WNOHANG". the process must not block). then it loops again and keep doing this cycle, until all processes have been launched. when getting to this point, it simply waits the rest.
<ofranja> it makes use of the non-blocking waitpid's capabilities so it doesn't have to be multi-threaded.
<ofranja> the problem is that it was locking at some places, because of processes not returning.
<ofranja> when searching for the problem, i found this behaviour at waitpid.
bk_ has joined #ocaml
<ofranja> interesting, i think i found the problem.
<ofranja> but it's a bit non-sense.
<ofranja> removing a harmless a := b from the code solves the problem, but it is very strange: this atribution shouldn't affect the code.
<ofranja> in fact, the only thing that changes is a prerr_endline!
<mflux> can you make a smaller test case that demonstrates the problem?
<ofranja> yes, i have one here?
<ofranja> yes, i have one here. wanna see it?
<mflux> well, why not
<ofranja> i'm trying to reproduce the problem modifying the code you pasted here, so i can see what is the real reason of the problem.
<mflux> but does it have anything to do with create_process or waitpid anymore?
<mflux> if the assignment was the trouble maker ;)
<ofranja> funny, taking off the assignment made it work the first time. now, it's not working anymore.
<mflux> have you checked what waitpid returns in case of a process still pending
<mflux> for me it returned (pid, WSIGNALED 7)
<mflux> try this implementation: let rec waitall n = if n > 0 then (Printf.printf "Waiting..\n%!"; waitall (match Unix.waitpid [Unix.WNOHANG] (-1) with _, (Unix.WSIGNALED _) -> (Unix.sleep 1; n) | pid, (Unix.WEXITED _) -> Printf.printf "%d exited\n%!" pid; n - 1 | x, _ -> Printf.printf "Dropping %d\n%!" x; n - 1)) else Printf.printf "Complete\n";;
<mflux> that might be a bug in waitpid though
<mflux> I think it actually should raise an exception
<mflux> with the unix error code etc
<ofranja> well, i just - for the test program - made it loop.
<ofranja> when there is no child left, it raises the ECHILD exception.
<mflux> so what should the symptom of the problem be?
<mflux> ocaml unix.cma wait_problem.ml seems to successfully exit for me (ocaml 3.07)
<ofranja> nice. maybe it's my ocaml (3.07p2)
<ofranja> i'll just upgrade and see what happens.
<mflux> well actually debian unstable release of ocaml, version 3.07.2a-4
<mflux> btw, do you actually have /usr/bin/true?
<mflux> because commonly it's at /bin/true
<mflux> solaris does have /usr/bin/true, though
<mflux> still exhibits the same behavior for me though, with the filename fixed
<ofranja> # ls -lah /usr/bin/true
<ofranja> -rwxr-xr-x 1 root root 11K 2004-05-10 00:49 /usr/bin/true
<mflux> huge 8-)
<mflux> hm, but it seems to be the same as in my linux
<mflux> it was just the solaris version that was 300 bytes ;)
<ofranja> heh. :)
srv has joined #ocaml
<ofranja> ok, time to cross the fingers.
<ofranja> oops. same problem.
<ofranja> i think the problem is in a lower-level place: the kernel.
<ofranja> i'll get a vanilla 2.6 and test it again.
<ofranja> it's the kernel.
<ofranja> :-)
<ofranja> (or maybe some bad combination of kernel + glibc + luck).
<ofranja> i've ssh'ed into another machine and it worked just fine.
<ofranja> well, tks for the help, mflux.
<mflux> I too have 2.6 ;)
<mflux> 2.6.5 infact
<mflux> but, coffee &
<ofranja> the other i tested is a 2.6.5-rc3.
<ofranja> this one is a 2.6.6-cko1-elpp-nvidia (the -nvidia is just to show it doesn't have CONFIG_REGPARM enabled).
kinners has joined #ocaml
Lemmih_ has quit ["Leaving"]
_fab has quit []
smimou has joined #ocaml
karryall has joined #ocaml
<jlouis> mflux: try file `which true`
<jlouis> ;)
<jlouis> IIRC it is a shell script
<jlouis> (on solaris)
<jlouis> annah$ ll /usr/bin/true
<jlouis> -r-xr-xr-x 1 root bin 79 Jun 28 17:12 /usr/bin/true*
<jlouis> also is on OpenBSD
<mflux> I see,
<mflux> but still.. 11k for /bin/true..
demitar_ is now known as Demitar
<mflux> some os had elegant /bin/false
<mflux> 0 bytes
<Demitar> Mostly runtime.
<Demitar> But a shell script might actually be faster due to cache locality.
<mflux> I doubt it
<mflux> that code wouldn't fit to cache anyway
<mflux> that is, starting a new process, executing a binary, parsing the code
<mflux> well, actually, it might ;)
<mflux> running shell propably means using the dynamic linker too, though
<Demitar> mflux, well, it would probably be cached in memory anyway, and CoW does it's part.
<mflux> CoW isn't free either
vezenchio has joined #ocaml
pattern has quit [Read error: 60 (Operation timed out)]
_fab has joined #ocaml
pattern has joined #ocaml
AshW8rk3 has joined #ocaml
fab__ has joined #ocaml
AshW8rk3 has quit [Remote closed the connection]
_fab has quit []
FredCods_ has quit [Read error: 110 (Connection timed out)]
<ita> does anyone know if it is possible to use automake/autoconf with ocaml ?
<ita> or if there is an example of such a thing even ?
kinners has quit ["leaving"]
<karryall> ita: autoconf, yes I use it often
* cDlm is still wondering if it is possible to actually use autoconf :>
<ita> karryall: do you have an example of such an app ?
<ita> cDlm: it works well - kde for example - as long as you don't touch the scripts to much
<karryall> lablGTK
<ita> cDlm: why do you use coercions on your sentences ? :)
<cDlm> m4 is black magic to me
<karryall> bah it's quite simple
<ita> karryall: nah, lablgtk is ugly - and i prefer doing guis in c++ (much more easier) - but ok, i'll try
<karryall> supidly simple
<ita> ah yes, lablgtk uses autoconf ..
<cDlm> probably, but it is still completely unreadable
<ita> never thought of that
* cDlm does have problems with macro languages
<ita> cDlm: makefile.am syntax is rather simple though
<cDlm> maybe
<karryall> as for automake, I remeber someone posting about it a few months ago on caml-list
<karryall> never tried though
<ita> but the thing i don't like is that ./configure takes often more than 1Mb - even for 20kb programs
<ita> and it is slow as hell
<karryall> 100Kb rather
<ita> everytime it is re-run it takes as much time - it does not memorize the config - and this is really really stupid
<karryall> ita: you hardly ever need to re-run it and it does have support for caching the test results
<karryall> ita: and what's ugly about lablgtk ?
<ita> karryall: the gui - gtk2 is slow and ugly, even with themes
<ita> the only reason i'd use gtk is that it allows writing closed-source programs
<ita> mmm i wonder if lablgtk allows writing closed-source programs too - there is nothing concerning the licensing on the webpage
kosmikus1away is now known as kosmikus
<karryall> ita: lablGTK's licence is the same as ocaml, LGPL + static linking exception
<ita> this is great
<ita> i'll probably use it finally
<ita> after all, it may not be like the gtk i know (in c - which is a mess to program with)
<karryall> coding with lablGTK is much more compact, yes
<karryall> thanks to optional arguments, closures, etc.
<jdrake> might lablgtk be as quick and easy as objective c is on mac?
<karryall> I don't know objc, I can't compare
<ita> compiling perhaps, but i doubt the gui could be snappier :-/
<jdrake> is there any resource format that is available, so you don't have to be coding the gui creation
<ita> i mean using the gui - have you ever tried gnome2 ?
<karryall> jdrake: for GTK you have libglade
CosmicRay has joined #ocaml
AshW8rk3 has joined #ocaml
AshW8rk3 has quit [Remote closed the connection]
<mflux> ita, atleast libgtkmm (the c++-wrapper for gtk+) is quite a different animal (much more pleasant ;)) from gtk+ to use
<jdrake> can C++ ever be pleasant to use?
<mflux> yes.
<cDlm> jdrake: depends on your mental health :>
* cDlm runs
<jdrake> cDlm, you see I have always valued that mental health thing
<mflux> what doesn't kill you makes you stronger.
slashvar[lri] is now known as slashvar[ens]
AshW8rk3 has joined #ocaml
lam_ is now known as lam
Snark has left #ocaml []
demitar_ has joined #ocaml
Demitar has quit [Read error: 110 (Connection timed out)]
<jdrake> does ocaml have any good ide under X
<cDlm> emacs :)
<jdrake> i said *good*
<cDlm> :) -- there is cameleon but I never used it
<slashvar[ens]> jdrake: emacs is the better ide I ever tried
AshW8rk3 has quit [Remote closed the connection]
<slashvar[ens]> other ide are just here to keep you away from your code
<slashvar[ens]> ;)
<jdrake> slashvar[ens], never could get into it, it always felt like s&m or anal rape or something like that
<cDlm> lol
<jdrake> not intending any special imagery there
fab__ has quit [Read error: 104 (Connection reset by peer)]
fab__ has joined #ocaml
<ita> cameleon ... does it work with gtk2 ?
demitar_ is now known as Demitar
<jdrake> not by the looks of it
<Demitar> jdrake, where emacs really shines is when it comes to navigating code without moving you hands. ELisp is merely a bonus. :)
<jdrake> if you don't move your hands want are you supposed to move
<cDlm> your feet, for pedal shortcuts.
<jdrake> and if I don't have feet?
<Demitar> Fingers? The point being that your wrists can rest while you move about and switch buffers and whatnot. :)
<Demitar> Relocating your hand to either the arrow keys or the mouse is a waste of time generally.
<cDlm> time does not matter so much
<jdrake> time is a relative beast
ita has quit ["leaving"]
<Demitar> Well it takes thinking time too. :)
<Demitar> You need to move your point of view among other things.
<jdrake> subethaedit will work until I have gnome installed anyways, even then I won't be on mac for a lot longer
<slashvar[ens]> oh, about cameleon, you need an external editor, there's no editor included
<jdrake> oh, no point then :-0
<jdrake> if you have 'type foo = Nothing | Int of int;;' what exactly is 'Nothing'
<slashvar[ens]> the possibility for a value of type foo to have no value
<cDlm> hm
<slashvar[ens]> (hum ... I don't like my sentence ;)
<cDlm> Nothing is just another value of type foo
<slashvar[ens]> the idea, is more relevant in a recursive structure
<jdrake> ok, as another example: type sign = Positive | Zero | Negative;;
<slashvar[ens]> jdrake: it's enumerate type
<jdrake> those supposed to be equivalent to an enum, are those just as equal concept-wise as Nothing?
<cDlm> yes
<slashvar[ens]> (then you can make a match against Positive or Zero or Negative)
<slashvar[ens]> they are datatype embeding unit
whee has joined #ocaml
<jdrake> what if you needed to associate an actual value to them for storage purposes
<jdrake> or is that just a match statement when needed
<cDlm> let serialize = function Nothing -> "<nothing/>" | Int i -> "<integer>...
<jdrake> that looks wierd
<cDlm> why ?
<jdrake> in experience
<jdrake> inexperience rather
<Demitar> Well camlp4 has some extensions, but in general you probably want a well defined storage anyway (perhaps one of the xml libs as backend).
<cDlm> it's not like in C where enums are just a nice way to name integers
<slashvar[ens]> Demitar: or <advertisement>use CDuce and its wonderfull interface with ocaml</advertisement> ;)
MadCoder has joined #ocaml
<MadCoder> well, there is people here, great
<MadCoder> anybody aware ?
MadCoder has left #ocaml []
FredCods has joined #ocaml
fab__ has quit []
monotonom has joined #ocaml
<mflux> I can't say about the others, but I personally have gained the level of self-awareness.
_fab has joined #ocaml
avn has quit ["leaving"]
<jdrake> in reading a tutorial it tries to explain boxed and unboxed types, but it doesn't quite explain it enough
bk_ has quit ["Leaving IRC - dircproxy 1.1.0"]
ronwalf has quit [Read error: 110 (Connection timed out)]
<ofranja> jdrake: i saw you were looking for a ocaml IDE. well, i use nano to edit the code, most of the time, but there is a program called mlglade which converts a glade file into ocaml code.
avn has joined #ocaml
<ofranja> the code is in lablgtk1 flavour, but you just have to change some optimal arguments, and replace some names that has changed (notably the textbox name).
<ofranja> port the mlglade to lablgtk2 / glade2 is an option, too, because it just have to parse the XML and generate the code (and there are some ready xml libraries for ocaml).
FredCods has quit [Read error: 110 (Connection timed out)]
ronwalf has joined #ocaml
FredCods has joined #ocaml
_fab has quit [Read error: 110 (Connection timed out)]
<jdrake> ofranja, interesting, might look into that.
<mflux> mm. let's say I have type t = { foo : int; bar : int };; and let a = { foo = 42; bar = 10 }; , now can I define b so that I make a copy of a but modify one field, without writing out the other field in a?
<Riastradh> I don't think so.
<mflux> similar to what one can do with objects, {< a = 42 >}
<mflux> too bad ;)
<mflux> I suppose I won't be filling that 4-field record one by one then
<Riastradh> You can in SML!
<mflux> ;(
<mflux> I wonder how much space does 10k hash tables take compared to 10k 4-field records
<Riastradh> Um, quite a lot more, I'm sure.
<mflux> I suppose I'll settle to lists
<karryall> let b = { a with foo = 32 }
<karryall> is it what you want ?
<mflux> it would look very much like it
<mflux> thanks
<mflux> ..although the solution with lists might still actually be better
<Riastradh> Why?
<mflux> I'm parsing nntp articles
<mflux> thought first of using article with a fixed set of fields
kosmikus is now known as kosmikus|away
maihem has joined #ocaml
karryall has quit ["tcho"]
mrsolo has quit [Connection reset by peer]
FredCods_ has joined #ocaml
FredCods_ is now known as ghost
ghost is now known as FredCods_
FredCods has quit [Nick collision from services.]
FredCods_ is now known as FredCods
mattam_ has joined #ocaml
karryall has joined #ocaml
jason has joined #ocaml
GreyLensman has joined #ocaml
mattam has quit [Read error: 110 (Connection timed out)]
mrsolo has joined #ocaml
mrsolo has quit [No route to host]
_fab has joined #ocaml
cjohnson has joined #ocaml
FredCods has quit [Read error: 60 (Operation timed out)]
FredCods has joined #ocaml
CosmicRay has quit ["Client exiting"]
FredCods_ has joined #ocaml
FredCods has quit [Nick collision from services.]
FredCods_ is now known as FredCods
GreyLensman has quit ["Leaving"]
maihem has quit ["Read error: 54 (Connection reset by chocolate)"]
ofranja has quit ["."]
monotonom has quit ["Don't talk to those who talk to themselves."]
vezenchio has quit ["With little power comes little responsibility"]
vezenchio has joined #ocaml
smimou has quit ["?"]
vezenchio has quit ["With little power comes little responsibility"]