mbishop changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | Grab Ocaml 3.10.0 from http://caml.inria.fr/ocaml/release.html (featuring new camlp4 and more!)
hcarty_ has quit ["leaving"]
hcarty has joined #ocaml
Riesz has joined #ocaml
shawn has joined #ocaml
pantsd has quit [Read error: 110 (Connection timed out)]
clog has joined #ocaml
ziggurat has quit ["Leaving"]
shawn has quit [Read error: 113 (No route to host)]
eumenides has quit [Read error: 104 (Connection reset by peer)]
eumenides has joined #ocaml
pantsd has joined #ocaml
seafood has quit [Remote closed the connection]
seafood has joined #ocaml
love-pingoo has joined #ocaml
smimou has joined #ocaml
<kelaouchi> i am trying to compile http://alain.frisch.fr/soft#postgres but here is what i get : http://pastebin.ca/539277
<kelaouchi> can anybody help me ?
<love-pingoo> kelaouchi: what's line 84 of libpq_stub.c ?
<tsuyoshi> conn_callback(vconn) = NULL;
<love-pingoo> conn_callback must be a macro defined somewhere
<tsuyoshi> #define conn_callback(v) ((np_callback*) Field(v,2))
<love-pingoo> ok
<love-pingoo> I don't know ocaml C interface that well
<love-pingoo> but Field is probably another valid lvalue macro
<tsuyoshi> assigning to Field() like that is not supposed to be done
<tsuyoshi> but I don't know why you'd get an error compiling it
<love-pingoo> #define Field(x, i) (((value *)(x)) [i]) /* Also an l-value. */
<love-pingoo> tsuyoshi: sure ?
<tsuyoshi> yeah.. you can assign to Field() under certain circumstances
<tsuyoshi> I think it should compile but maybe screw up the gc
<love-pingoo> kelaouchi: is caml/mlvalues.h included ?
<tsuyoshi> maybe assigning NULL is ok though
<pango> is there a good reason to use an old version of this library ?
<tsuyoshi> hmm.. let me try to compile it
<love-pingoo> tsuyoshi: ah I see, one should prefer the Store_field and Store_double_field macros
<pango> bbl
<kelaouchi> oups
<kelaouchi> i could compile
<kelaouchi> but from another source i found at : http://www.ocaml.info/home/ocaml_sources.html
<kelaouchi> sure pango
<tsuyoshi> how odd, I get the same errors
<kelaouchi> pango i just followed http://sandbox.merjis.com/dependencies
<kelaouchi> that's why i used this version
<kelaouchi> thx for your help guys
<tsuyoshi> I have written code very similar to this and it compiled just fine
<tsuyoshi> this is very puzzling
<tsuyoshi> well, maybe if I look at what I wrote I will see the difference
Submarine has quit ["Leaving"]
<kelaouchi> do you use mod_caml-1.3.6 with apache-2.2.4nb3 ?
<tsuyoshi> no, I didn't even know there was a mod_caml
<tsuyoshi> oh where is Field defined
<kelaouchi> i am trying to compile it but i get http://pastebin.ca/539305
<kelaouchi> here is the Makefile : http://pastebin.ca/539308
<tsuyoshi> in mlvalues.h
<tsuyoshi> hmm ok it is including mlvalues.h
<tsuyoshi> so that's not the problem
<tsuyoshi> maybe the cast is screwing it up?
<tsuyoshi> yes
<tsuyoshi> it must be something that gcc previously allowed but doesn't anymore
<tsuyoshi> this isn't hard to solve though
<kelaouchi> anybody here using cocanwiki ?
<tsuyoshi> change the #define conn_callback line to:
<tsuyoshi> #define conn_callback(v) (*(np_callback**) &Field(v,2))
<tsuyoshi> and change the #define res_callback line to:
<tsuyoshi> #define res_callback(v) (*(np_callback**) &Field(v,2))
<tsuyoshi> and it compiles fine
<tsuyoshi> ha, yeah.. that's the way I wrote my code to begin with
<tsuyoshi> I never even considered that in C I could cast something the way they did in this
<kelaouchi> worked for me
<tsuyoshi> oh, ok
<kelaouchi> but now having troubles with mod_caml
<flux> I wonder what has spurred the recent mod_caml-activity on the channel :)
<tsuyoshi> kelaouchi: those are all make errors
<tsuyoshi> maybe it requires gnu make and you're using bsd make?
<kelaouchi> yes it is tsuyoshi
<kelaouchi> sorry for the paste
<kelaouchi> it was not the good one :/
eumenides has quit [Read error: 104 (Connection reset by peer)]
nearfar has joined #ocaml
smimou has quit [Read error: 104 (Connection reset by peer)]
love-pingoo has quit ["Connection reset by pear"]
<kelaouchi> so here is what i get running `gmake all` for mod_caml-1.3.6 : http://pastebin.ca/539555
<kelaouchi> here is the Makefile.config : http://pastebin.ca/539557
<tsuyoshi> you're missing apache header files
<kelaouchi> shouldn't -I$(APACHEINCDIR) in CFLAGS be enough ?
<tsuyoshi> I don't know
<kelaouchi> the command was : `cc -I/usr/pkg/include/httpd -O2 -I/usr/pkg/include -I/usr/include -c -o mod_caml_c.o mod_caml_c.c`
<kelaouchi> looks like it is missing /usr/pkg/include/apr-1
<kelaouchi> where apr.h, apr_hooks.h, apr_optional_hooks.h, ... are
<tsuyoshi> I gotta get to sleep.. 1:33am here
<kelaouchi> oh ok tsuyoshi
<kelaouchi> np
<kelaouchi> here is 10:45
Demitar has quit [Read error: 104 (Connection reset by peer)]
Demitar has joined #ocaml
olegfink has quit [Read error: 110 (Connection timed out)]
<kelaouchi> `cc -I/usr/pkg/include/httpd -O2 -I/usr/pkg/include -I/usr/include -I /usr/pkg/include/apr-1 -I /usr/pkg/lib/ocaml -c -o mod_caml_c.o mod_caml_c.c` works
<rwmjones> kelaouchi, I missed this, what are you trying to do?
<kelaouchi> to compile mod_caml-1.3.6 with apache-2.2.4nb3 on NetBSD 4.99.20
<kelaouchi> to get cocanwiki working
<rwmjones> what's the error?
<kelaouchi> and Makefile.config on http://pastebin.ca/539557
<rwmjones> you need to find out where apr.h is located and make sure you've got -I/path/to/there on the command line
<kelaouchi> i did
<rwmjones> are freenode chats archived anywhere?
<kelaouchi> it is located in /usr/pkg/include/apr-1
<kelaouchi> rwmjones ?
<rwmjones> you've got: APACHEINCDIR := $(shell $(APXS) -q INCLUDEDIR)
<kelaouchi> yes i have
<rwmjones> so either apxs is giving out the wrong INCLUDEDIR or you can put the right path here instead
<kelaouchi> no it is the good one :
<kelaouchi> nimred@Vohfi: ~/OCAML/mod_caml-1.3.6 # /usr/pkg/sbin/apxs -q INCLUDEDIR [ Tuesday 06/05/07 10:44:05 ]
<kelaouchi> /usr/pkg/include/httpd
<kelaouchi> for apache headers
<kelaouchi> nimred@Vohfi: ~/OCAML/mod_caml-1.3.6 # locate apr.h
<kelaouchi> usr/pkg/include/apr-1/apr.h
<kelaouchi> this one is missing
<rwmjones> if I were you I'd hack the Makefile to add the right path, it needs to get both the apr headers and the apache headers
<kelaouchi> i did rwmjones
<kelaouchi> also had /usr/pkg/lib/ocaml
<kelaouchi> CFLAGS := -I$(APACHEINCDIR) $(shell $(APXS) -q CFLAGS) -I /usr/pkg/include/apr-1 -I /usr/pkg/lib/ocaml \ $(shell $(APXS) -q CFLAGS_SHLIB)
<kelaouchi> but still getting some errors : http://pastebin.ca/539604
<kelaouchi> :/
<kelaouchi> any idea rwmjones ?
<rwmjones> probably you need to add -lapr to the command line there ... there's a Fedora meeting this evening, and if that goes well then I'll be packaging up mod_caml in a day or two anyway
<rwmjones> there are other, known problems with mod_caml & apache 2.2 at the moment
slipstream-- has quit [Read error: 104 (Connection reset by peer)]
slipstream has joined #ocaml
love-pingoo has joined #ocaml
<oracle1> hi. is there a library or so which provides random numbers following a distribution other than uniform?
nearfar has quit [Read error: 110 (Connection timed out)]
screwt8 has quit [Remote closed the connection]
<oracle1> probably ocamlgsl
<G> rwmjones: evening
olegfink has joined #ocaml
<rwmjones> G evening
<rwmjones> or lunchtime as it is here :-)
<G> heh
<G> I must go back and read all the ocaml stuff on the fedora lists
<G> had an exam last week, but for some reason I'm even busier now ;)
<kelaouchi> what library is missing : http://pastebin.ca/539830 ?
Hadaka has quit [kubrick.freenode.net irc.freenode.net]
tree_ has quit [kubrick.freenode.net irc.freenode.net]
Hadaka has joined #ocaml
tree_ has joined #ocaml
Hadaka has quit [Read error: 104 (Connection reset by peer)]
<rwmjones> kelaouchi, if you use 'nm -D' on the various libraries which Apache has installed, you should be able to list out the symbols they provide until you find the one needed
<rwmjones> for example:
<rwmjones> nm -D /usr/lib/libapr-1.so.0.2.7 | less
<rwmjones> as an example has:
<rwmjones> 000000000000fed0 T apr_file_open
<rwmjones> which means that apr_file_open is provided (as a 'T'ext symbol, so it's a function)
<rwmjones> and also has:
<rwmjones> U closedir
<rwmjones> which means that closedir is 'U'ndefined (ie. provided by another library - in this case, glibc)
<rwmjones> T = text (functions), D = data, U = undefined (required by this library, provided by another library)
ziggurat has joined #ocaml
mbishop_ has joined #ocaml
eradman has quit [Remote closed the connection]
eradman has joined #ocaml
Naked has joined #ocaml
Naked is now known as Hadaka
<kelaouchi> thx rwmjones ;)
noteventime has joined #ocaml
what3_ has joined #ocaml
<kelaouchi> not sure this mod_caml is ok anyway
<kelaouchi> not sure it is up to date
<kelaouchi> to be able to work with apache v2
mbishop has quit [Read error: 110 (Connection timed out)]
what3 has quit [Read error: 110 (Connection timed out)]
<rwmjones> kelaouchi, there are some known bugs. If you contact Joel Reymont, he's got it working with latest Apache. I'll be trying to do the same later this week.
what3_ is now known as what3
ziggurat has quit ["Leaving"]
pango has quit [Remote closed the connection]
pango has joined #ocaml
noteventime has quit [Remote closed the connection]
descender has quit [Read error: 110 (Connection timed out)]
descender has joined #ocaml
malc has joined #ocaml
malc is now known as malc_
malc_ is now known as malc
lamby has joined #ocaml
<lamby> Can anyone think why you must specify "rec" for a recursive call in (Oca)ML?
<malc> shadowing - let a n = print_int 1; let a n = a n;
<flux> I don't know the rationale, but I sometimes like to reuse identifier within functions, and if they were recursive, it wouldn't quite work
<flux> however, for shadowing top-level definitions is what has bitten me a few times, I don't like it :)
<flux> s/for //
<lamby> Yes, I'm thinking the shadowing thing is annoying. The only reason I can come up is that there are different formal semantics for recursive method calls and non-recursive.
<lamby> ..And you might need some hand-waving rule so that a prover chooses the right one if you didn't have it explicit.
<rwmjones> lamby, it's common to want to redefine previous definitions
<rwmjones> I often write code which looks like:
<rwmjones> let xs = List.map (...) xs in
<rwmjones> let xs = List.map (...something else...) xs in
<rwmjones> where 'xs' is being passed through a series of transformations
<rwmjones> so you need to be able to tell the different between let (above) and let rec (not used nearly so often)
cjeris has joined #ocaml
<lamby> rwmjones: Mmm yes that makes sense.
mikeX has joined #ocaml
schme` is now known as schme
pantsd has quit ["Leaving."]
tty56 has quit ["leaving"]
<kelaouchi> rwmjones : who is Joel Reymont ?
<rwmjones> kelaouchi, http://wagerlabs.com/
tty56 has joined #ocaml
schme` has joined #ocaml
_blackdog has joined #ocaml
pango has quit [Remote closed the connection]
schme has quit [Connection timed out]
pango has joined #ocaml
mbishop_ is now known as mbishop
avu has left #ocaml []
bebui has joined #ocaml
pango has quit [Remote closed the connection]
bebui has quit [Client Quit]
love-pingoo has quit ["Leaving"]
malc has quit ["leaving"]
bebui has joined #ocaml
pango has joined #ocaml
bebui has quit ["leaving"]
bebui has joined #ocaml
zarvok has joined #ocaml
zarvok has left #ocaml []
zarvok has joined #ocaml
Demitar has quit [Remote closed the connection]
Demitar has joined #ocaml
shawn has joined #ocaml
ygrek has joined #ocaml
screwt8 has joined #ocaml
<tree_> Hi, how can i compile the bytecode file to make regular unix executable from it?
<tree_> i dont have the source, only the result of ocamlc compilation
schme`` has joined #ocaml
smimou has joined #ocaml
<Smerdyakov> I don't know of any way.
<Smerdyakov> (Any way without writing some new tool, I mean.)
schme``` has joined #ocaml
JeffSmac has joined #ocaml
<flux> tree_, so you have .cmo-files or an executable with byte code?
JeffSmac has quit [Client Quit]
schme``` is now known as schme
shawn__ has joined #ocaml
shawn has quit [Connection timed out]
jao has quit []
schme` has quit [Connection timed out]
schme`` has quit [Connection timed out]
screwt8 has quit [Read error: 104 (Connection reset by peer)]
schme has quit [Success]
benny_ has joined #ocaml
screwt8 has joined #ocaml
<tree_> flux: i have only executable
benny has quit [Read error: 110 (Connection timed out)]
mikeX has quit ["leaving"]
zarvok has quit [Read error: 110 (Connection timed out)]
eumenides has joined #ocaml
_blackdog is now known as _blackdog_away
<mbishop> I doubt there is a way to produce source or a native code image from bytecode
<mbishop> I know Jon Harrop offers some new visualization stuff in ocaml, and gives a bytecode version away for free
<mbishop> but the code itself costs money
<tsuyoshi> hmm.. converting jon's ray tracer to work with the fork map is easy
ygrek has quit [Remote closed the connection]
<mbishop> fork map?
<mbishop> is that like the erlang pmap?
ygrek has joined #ocaml
<rwmjones> mbishop, see the endless discussion on caml-list
<rwmjones> it's a Array.map which forks off processes
<mbishop> Hmm, doesn't using marshalling make it no longer safe?
<rwmjones> well, since it's just forking you don't have arch/version problems
bluestorm_ has joined #ocaml
<tsuyoshi> yeah.. it's perfectly safe as long as you annotate it properly
<tsuyoshi> val map: int -> int -> ('a -> 'b) -> 'a array -> 'b array
<tsuyoshi> ok.. parallelizing each row doesn't seem to be very fast
<tsuyoshi> ack
<tsuyoshi> it died creating the pipe
<tsuyoshi> ENOTBLK
<tsuyoshi> wtf is going on
jao has joined #ocaml
<tsuyoshi> well, now it works
<tsuyoshi> I need to investigate that error message though
<tsuyoshi> takes 7 seconds longer on my single-core system
<tsuyoshi> anyone else want to try this out?
Oxylin has joined #ocaml
<rwmjones> tsuyoshi, what are you parallelising?
<tsuyoshi> jon harrop's ray tracer
<rwmjones> I have a 4 core Athlon here
<tsuyoshi> cool
<rwmjones> even cooler, AMD gave it to me for free
<tsuyoshi> lemme put the files on my web site
<tsuyoshi> oh I should put a makefile in there
<tsuyoshi> there
<tsuyoshi> oh.. I didn't put in his optimization flags
<rwmjones> what's ocaml.mk?
<rwmjones> oh right, included by Makefile
<tsuyoshi> ok, now the flags are in the makefile
<tsuyoshi> hmm.. my server thinks all these files are binary
<tsuyoshi> I need to fix that
<rwmjones> I must be missing something ... 'make' does nothing, and make forkray needs test_fork.cmx
<tsuyoshi> oh whoops
<tsuyoshi> just change test_fork.cmx to fork.cmx
<tsuyoshi> or
<tsuyoshi> change it to forkray.ml
<tsuyoshi> sorry.. I just compiled it manually without using the make file
<tsuyoshi> hmm
<tsuyoshi> it still doesn't work
pantsd has joined #ocaml
<tsuyoshi> I guess I don't understand ocaml dependencies at all
<rwmjones> tsuyoshi, I've got to go in a second, but at the moment I'm getting:
<rwmjones> $ ocamlopt -c forkray.ml
<rwmjones> File "forkray.ml", line 16, characters 45-47:
<rwmjones> This expression has type 'a list but is here used with type
<rwmjones> ((float * float * float) * float * 'a list) list
<tsuyoshi> are you compiling with -rectypes?
<rwmjones> ah ok, works
<tsuyoshi> so compile that one and see what the speed difference is
rwmjones is now known as rwmjones_away
<flux> tsuyoshi, which ray.ml did you base that on?
<tsuyoshi> the minimal one
<flux> hm
<tsuyoshi> oh haha I forgot there are a whole bunch of versions on there
<flux> I took fork.tar.bz2
<flux> top only displays one process taking 99% cpu
<tsuyoshi> running forkray?
<flux> so what am I doing wrong_
<flux> ah, only ray
<tsuyoshi> oh ray is the original
<flux> ..so I can just use that and not get anything from ffconsultancy..
<tsuyoshi> yeah
<flux> 34.695s for the original
<flux> ./forkray > ray.kuva2 34,96s user 0,24s system 196% cpu 17,923 total
<tsuyoshi> awesome
<flux> and it produces the same picture
Oxylin has quit [Client Quit]
<flux> hm, somehow the length of fork.ml surprises me, but I suppose 130 lines is ok
<tsuyoshi> the version without select was a lot simpler
<tsuyoshi> I think actually it was a mistake to use an array to store the children's state
<tsuyoshi> should go back to using a map
<flux> why can't it use Array.init instead of that Obj.magic-trick?
<Smerdyakov> Obj.magic? Sounds like someone wants a language with type-level computation.
<tsuyoshi> flux: no suitable default value
<flux> init doesn't need default value
<flux> you provide it a default initialization function
<flux> and as far as I can see, you could replace that for-loop with Array.init
<tsuyoshi> which one?
<flux> the first one in map
<tsuyoshi> oh
<tsuyoshi> I tried that actually
<tsuyoshi> it doesn't work because you can't fork in the middle of an Array.init
<tsuyoshi> or maybe you can, but both the child and the parent options have to have the same type and I couldn't get it to compile
<flux> hmm
<flux> oh, I can see what the problem was, but I fixed it
<tsuyoshi> the child process doesn't actually ever return.. so if you could fool the type checker into accepting it...
<flux> assert false will tell that
<flux> modeemi.fi/~flux/patch
<flux> (formatting is bad, but I minimized the length of the patch)
<tsuyoshi> assert false?
<flux> assert false.
<flux> it clearly tells that this point of code cannot be reached :)
<flux> and from the type inference point of view it is 'a
<Smerdyakov> Just one of many ways of building an expression that has any type.
<tsuyoshi> oh really
<tsuyoshi> ohh that's much nicer
<tsuyoshi> I think a map would still be better than an array though
<Smerdyakov> It would be even nicer in a more advanced type system where "assert false" requires a proof of unreachability.
<tsuyoshi> I did a binary search but.. it seems kind of awkward
<flux> I suppose using array for that specific purpose is ok
<mbishop> Smerdyakov: what language would have that type system?
<Smerdyakov> mbishop, Coq does, but you can have even simpler language designs that have similar properties.
<tsuyoshi> flux: what kind of system do you have?
<bluestorm_> hm
<flux> tsuyoshi, dual athlon 1900+ MP
<tsuyoshi> someone running this on osx got 16 seconds extra system time in the forking version
<flux> ..with linux
<flux> 2.6 series
<tsuyoshi> I wonder if that means the osx scheduler sucks
<flux> do you think of trying out how a version that uses marshalling both ways would perform?
<tsuyoshi> that would be a bit more complicated.. would add another child state for writing
<flux> but it would allow using less than n processes
<tsuyoshi> I was also thinking of pipelining it
<tsuyoshi> less than n processes?
<flux> well, I suppose you could get that in other means too
<flux> where n is the length of list to process
<tsuyoshi> oh it's already doing that
<flux> oh
<tsuyoshi> the first argument to map is the number of processes
<flux> I didn't look that closely :)
<flux> but the case I was really thinking was doing pmap under pmap
<flux> it would need some manager process
<tsuyoshi> that is pretty cool that it gets a nearly 50% speedup though
<flux> well, yes.. but one cannot just search/replace map with pmap in an application and expect it to work (it will however if you avoid side effects), or get performance boost :). but I believe it has its uses.
<flux> years ago I wrote a class for c++ that provided fancy syntax for doing for-loops in parallel (forked in constructor and waited in destructor), but it required the result data would be placed in shared memory
<flux> didn't ever use it for anything, though :)
Smerdyakov has quit ["Leaving"]
Submarine has joined #ocaml
<oracle1> how can List.for_all throw a Division_by_zero exception eventho I dont do division in the function it calls?
<oracle1> oh
<oracle1> dont worry.
<jlouis> heh
<jlouis> Isn't it funny: You just have to write a single sentence, end it with a question mark and press enter. Then it reveals itself.
ygrek has quit []
shawn__ has quit [Read error: 110 (Connection timed out)]
love-pingoo has joined #ocaml
pantsd has quit [Read error: 110 (Connection timed out)]
tsuyoshi has quit ["Lost terminal"]
tsuyoshi has joined #ocaml
Smerdyakov has joined #ocaml
<tsuyoshi> what did flux say his system was again
bluestorm_ has quit ["Konversation terminated!"]
<Smerdyakov> He said it was fantastic.
<tsuyoshi> oh I'll just say an athlon running linux
love-pingoo has quit ["Connection reset by pear"]
malc has joined #ocaml
pango_ has joined #ocaml
malc has quit [Nick collision from services.]
malc has joined #ocaml
malc has quit [Nick collision from services.]
malc_ has joined #ocaml
garulfounix has joined #ocaml
cjeris has quit [Read error: 104 (Connection reset by peer)]
<tsuyoshi> after reading jon's new code I figured out I had a bug in mine
<tsuyoshi> I've only been closing half of the pipes
<tsuyoshi> that's what gave me the error before
_blackdog_away has quit ["Ex-Chat"]
bebui_ has joined #ocaml
bebui_ has quit [Client Quit]
<tsuyoshi> hmm.. what is he comparing to when he says "faster than any language that uses a concurrent GC"
<tsuyoshi> you could use this same method in any language, really
<tsuyoshi> it would be pretty easy in lisp, for instance
<tsuyoshi> if someone hasn't already done it
<Smerdyakov> And if someone has already done it, it will be really, really hard.
love-pingoo has joined #ocaml
joshcryer has quit [Client Quit]
joshcryer has joined #ocaml
<tsuyoshi> hmm.. now what if I made it autodetect the number of processors
malc_ has quit ["leaving"]