gildor changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | OCaml 3.12.1 http://bit.ly/nNVIVH
everyonemines has joined #ocaml
lopex has quit []
arubin has quit [Quit: arubin]
mdelaney has joined #ocaml
mdelaney has quit [Quit: mdelaney]
sebz has joined #ocaml
sebz has quit [Client Quit]
sebz has joined #ocaml
<everyonemines> Should I use camlp4 or ocamllex + ocamlyacc ?
<thelema> everyonemines: depends on what you're trying to parse
sebz has quit [Client Quit]
<thelema> if it's not particularly OCaml-ish, you should use ocamllex/yacc
<everyonemines> I'm not sure what that means. Which would you use for, say, HTML?
<thelema> if the language you're trying to parse is basically ocaml, use camlp4, otherwise lex+yacc
surikator has quit [Quit: Scientific discovery is just maximal compression of strings. Nothing more, nothing less.]
<everyonemines> Huh, apparently we're up to camlp5 now.
<thelema> camlp4 was heavily revised in ocaml version 3.10
<thelema> camlp5 is the old version of camlp4, renamed and still maintained outside inria
<thelema> (confusing enough?)
<everyonemines> oh ok
<everyonemines> Do you use any p4 extensions?
<thelema> no
<everyonemines> You can change the language a lot with just functions, and then you can use the module system too, so I never saw the need myself.
<everyonemines> It's sort of lisp-y that way.
<thelema> yup, there's little that needs camlp4.
<thelema> acually, lisp changes the language with macros, more like using camlp4, except that camlp4 is bolted on in a particularly orthogonal way, which makes it more trouble.
<everyonemines> Well, I meant philosophically.
<thelema> I can see how you would say that.
sebz has joined #ocaml
sebz has quit [Client Quit]
<everyonemines> I'm starting to feel like I should just stick to Str instead of using a parser generator. :-/
everyonemines has left #ocaml []
<thelema> if the language you're parsing is simple enough, I'd avoid parser generators.
<thelema> at least I'd avoid code-generation
<thelema> parser-combinators aren't bad.
Kevin_ has joined #ocaml
<Kevin_> Can anyone give me a quick understanding of why this code:
<Kevin_> let rec sum (x: int list) : int =
<Kevin_> match x with
<Kevin_> | [] -> []
<Kevin_> | xhd :: [] -> xhd ;;
<Kevin_>
<Kevin_> produces a type error?
Kevin_ has quit [Remote host closed the connection]
sebz has joined #ocaml
sebz has quit [Client Quit]
junsuijin has joined #ocaml
dnolen has quit [Quit: dnolen]
sebz has joined #ocaml
sebz has quit [Client Quit]
ulfdoz has joined #ocaml
jimmyrcom has quit [Read error: Operation timed out]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
mdelaney has joined #ocaml
hto has quit [Ping timeout: 240 seconds]
TaXules has quit [Ping timeout: 240 seconds]
zorun has quit [*.net *.split]
taupin has quit [*.net *.split]
willb has quit [*.net *.split]
TaXules has joined #ocaml
junsuijin has quit [Quit: Leaving.]
zorun has joined #ocaml
willb has joined #ocaml
hto has joined #ocaml
taupin has joined #ocaml
ulfdoz has quit [Remote host closed the connection]
<adrien> hcarty: cairo2's cairo_gtk C stubs should increase the reference count of the surface associated with the cairo context
sebz has joined #ocaml
Snark has joined #ocaml
ankit9 has joined #ocaml
larhat has joined #ocaml
ulfdoz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
jamii has joined #ocaml
ankit9 has quit [Quit: Leaving]
sebz has joined #ocaml
ttamttam has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
ttamttam has quit [Ping timeout: 245 seconds]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
jamii has quit [Quit: Leaving]
ankit9 has joined #ocaml
bobry1 has joined #ocaml
sebz has joined #ocaml
zorun has quit [Read error: Operation timed out]
ftrvxmtrx has quit [Ping timeout: 258 seconds]
jaar has joined #ocaml
avsm has joined #ocaml
surikator has joined #ocaml
ikaros has joined #ocaml
ulfdoz has quit [Ping timeout: 268 seconds]
sebz has quit []
sebz has joined #ocaml
pik has joined #ocaml
<pik> hi there
avsm has quit [Quit: Leaving.]
<pik> I'm starting to play around with js_of_ocaml
Snark has quit [Quit: Quitte]
<pik> anyone else has ?
<pik> I'm wondering when some markup is apparently not implemented in the Dom_html module
<pik> what should I do ?
<pik> btw is it able to output html5 ?
<pik> maybe that's the main question
ftrvxmtrx has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
pik has quit [Read error: Connection reset by peer]
pik has joined #ocaml
ftrvxmtrx has quit [Ping timeout: 252 seconds]
<raphael-p> pik: adding the tags/properties you need in the dom_html is quite straightforward
<raphael-p> and sending a patch to the ocsigen mailing list usually result in it being included in the repository
<raphael-p> pik: if you need help to add the constructs you need, feel free to ask
<pik> so the best way to do it is to patch dom_html ?
<pik> I was not sure if there was other way on "user side"
<pik> how about html5 ? I guess it's less straightforward
<raphael-p> pik: there is a user side way
<raphael-p> and you can indeed start with the user side and port it to the library later
<raphael-p> you can look at https://github.com/raphael-proust/d3/tree/master/src/bindings to see a user-side way of binding a javascript library
* pik is having a look
<raphael-p> and of course, the dom_html module in the js_of_ocaml repository can be used as an example of dom element bindings
ttamttam has joined #ocaml
<pik> ok
<pik> so dom elements can also be created with dom document##createElement ?
<pik> but this may output invalid doc ?
<pik> and adding stuffs to dom_html is cleaner ?
<raphael-p> yes
<raphael-p> if you create element, the compiler can't check for typos and such because you pass a string
<pik> to be more specific, I'd like to use the <ruby> extension to xhtml 1.1
<pik> this seems to be compatible with the dom_html output (I was afraid it was only html5 but apparently it's not)
ftrvxmtrx has joined #ocaml
<pik> oh, I just discovered this could be dealt with with CSS
<pik> too many options !
<pik> Let's try the xhtml way and patch dom_html, thank you raphael-p
hto has quit [Quit: Lost terminal]
<adrien> I need semaphores and I'm not sure how to implement them: I think I have a fairly good idea with Mutex and Condition but I don't know if there's not something better
hto has joined #ocaml
<adrien> does anyone have good/ok teaching material or tutorial about their implementation?
<adrien> I know how to use them but I've never seen anything explaining how to write them ='(
ftrvxmtrx has quit [Ping timeout: 264 seconds]
<adrien> or rather, spent time on their implementation for threading purposes
<ousado> adrien: for threading only?
pik1 has joined #ocaml
<adrien> ousado: yeah
pik has quit [Quit: Leaving.]
<adrien> and actually, using Condition was over-engineering
<adrien> well, I'll code what I have in midn and we'll see
<ousado> adrien: this is a very good implementation with good documentation: http://www.boost.org/doc/libs/1_47_0/doc/html/interprocess.html
<ousado> sure, my suggestion was to look at the code :)
<adrien> heh =)
<ousado> huh?
<ousado> heh
<adrien> what I have in mind is simply a { available : Mutex.t list; waiting : Mutex.t list } record
<adrien> I'll compare and see how they do it
<adrien> be back soon
lopex has joined #ocaml
<flux> hm, you don't associate an integer to a semaphore, but encode it in list lengths?
<flux> adrien, also, don't you need to protect the record itself with a mutex?
<ousado> flux: lists in ocaml are immutable, right?
<flux> ah, right. I somehow read that those fields were mutable, of course they are not.
<flux> so maybe that was a simplified version of what he had in his mind
<adrien> flux: of course
<adrien> flux: I plan to have an integer too but removed it for IRC ;-)
<adrien> and other simplifications, mostly because I'm not sure that I'll keep lists
<adrien> so a set of "available" and "waiting" mutexes sounds right?
<flux> hmm, I understand the 'waiting' list, but what is 'available'?
<ousado> adrien: for a single semaphore?
_andre has joined #ocaml
<adrien> I forgot bits of what I had in mind but I guess "available" could be replaced with an integer instead
<adrien> ousado: yes
<adrien> (yeah, "available" was over-engineering <3 )
<ousado> hm.. not sure why you'd want more than one mutex
<flux> I think he wants each 'down' to sleep on a mutex
<flux> so when it is upped, the up-operation can just unlock n mutexes, and no extraneous threads are woken up
<adrien> I want as many running threads as I have CPUs
<adrien> and yes, that was the idea
<adrien> I don't see how I could have several things running with only one mutex actually
<flux> you could, with a condition
<flux> but maybe having n mutexes is in fact more efficient
<ousado> well, not using the same resource, that's pretty much the point of it, right?
<adrien> right, with Condition, I an see
<adrien> but I'll be using only one semaphore at a time
<adrien> one data structure to protect at loading, and avoid firing too many threads and processes at saving
<ousado> I usually try to build my programs so they only try to lock a mutex and in case it doesn't work, continue doing other stuff
<flux> if you have small threads, that might not be the case
<flux> with Lwt you can have a 'thread' for the smallest things..
<flux> of course, you should always be doing work if there is some available :)
<adrien> I want to run many xz processes at the same time, while keeping track of their progress from a graphical application
olasd has quit [Ping timeout: 260 seconds]
olasd has joined #ocaml
<raphael-p> adrien: have you considered using Lwt? You could do that very simply using Lwt…
<adrien> raphael-p: yeah, I have, but I'm on windows so I'm trying to keep the deps light
<adrien> some would that that it's debatable since I'm using lablgt2, cairo2 and archimedes already ;-)
<adrien> flux: I think that the idea of making a list of "available" mutexes was C++ brain-damage: not having a garbage-collector ;-)
<hcarty> adrien: Have you sent a bug report or patch to the cairo2 project?
<adrien> hcarty: no, not yet: I tried that last change right before going to bed
<adrien> I don't know if I'll have time to do it tonight but if not, I'll have it done before the end of the week for sure
<hcarty> adrien: If you have a patch I can try to get the change in as well. I have commit access but I'm not likely to get to it before the end of the week either.
<adrien> on a clean source, put this on line 71 of cairo_gtk_stubs.c
<adrien> cairo_surface_reference(cairo_get_target(cr));
<adrien> hcarty: that solves the issue but I don't know if it's the best way to do it (although #gtk+ seemed to say so)
Kakadu has joined #ocaml
<hcarty> adrien: That makes sense. I recall reading something along those lines in the Cairo documentation.
<adrien> currently it's done when creating a context for not-gtk
<adrien> so there are two codepaths to create a context and only one to free them
ftrvxmtrx has joined #ocaml
jimmyrcom has joined #ocaml
eb4890 has joined #ocaml
surikator has quit [Quit: Computer is sleeping. I'm probably not.]
pik1 has left #ocaml []
metasyntax|work has joined #ocaml
_andre has quit [Quit: Lost terminal]
ztfw has joined #ocaml
dnolen has joined #ocaml
wtetzner has quit [Quit: Leaving]
_andre has joined #ocaml
avsm has joined #ocaml
ttamttam has quit [Ping timeout: 258 seconds]
_andre has quit [Ping timeout: 276 seconds]
ttamttam has joined #ocaml
Modius has joined #ocaml
dnolen has quit [Quit: dnolen]
Kakadu has quit [Quit: Page closed]
ankit9 has quit [Quit: Leaving]
Kevin___ has joined #ocaml
avsm1 has joined #ocaml
avsm has quit [Ping timeout: 258 seconds]
junsuijin has joined #ocaml
Kevin___ is now known as Karboncode
thomasga has joined #ocaml
lopex has quit []
spearalot has joined #ocaml
DimitryKakadu has joined #ocaml
joewilliams_away is now known as joewilliams
bobry1 has quit [Quit: Leaving.]
thomasga has quit [Quit: Leaving.]
mdelaney has quit [Quit: mdelaney]
<adrien> blah
<adrien> oh, crap, of course
<adrien> so, I wanted to avoid threading the gtk part of my application and did some stuff by myself
<adrien> code looks fine, types well, everything, but the threads don't seem to be running
<adrien> I'm waiting in some GTK stuff and therefore I don't make any allocation, and the other threads have no chance to run
<thelema> :)
<adrien> I need to find out how to add timeouts to gtk and Thread.yield from there
<thelema> just put an event in the loop
<thelema> Idle.add
<adrien> do you have anything specific in mind? GMain has a bunch of functions (modules actually)
<adrien> ok, thanks
ttamttam has left #ocaml []
<adrien> I'll have to benchmark my code
<adrien> I wonder if I'm not having a *HUGE* amount of context switches
<adrien> and I need to check this semaphore implementation
<NaCl> adrien: sounds like fun
<NaCl> or "fun"
<adrien> ah, found the bug but will I have time to fix it
<adrien> noooooooooooooooooo, stupid bug
<adrien> let wait ({ count; mutex } as t) n = Mutex.lock mutex; .... use_of count ...
<adrien> but "count" was keeping the old value, before the mutex was unlocked! doh!
<adrien> sorry, </mylife>
<thelema> oops
larhat1 has joined #ocaml
larhat has quit [Read error: Connection reset by peer]
<hcarty> adrien: I tried your patch and it works well here. I haven't checked for memory leaks or anything of that sort, but the assert not longer happens.
<hcarty> adrien: Thanks for testing that!
<adrien> ='(
<adrien> I think it's possible to lock the same mutex twice on windows
<adrien> hcarty: =)
bohanlon_ has quit [Quit: leaving]
<adrien> hcarty: I tried testing for memory leaks by triggering lots of redraws (resizing or moving the window)
<adrien> if the mutexes aren't working...
mdelaney has joined #ocaml
Anarchos has joined #ocaml
<adrien> I think I'll get rid of the mutexing since in one case I don't need concurrent jobs, and in the other, I don't need to mutex; so much for my parallel job module with progress reporting
_andre has joined #ocaml
thomasga has joined #ocaml
* Anarchos found a bug in his huge 265 line method, thanks to ocamldebug !
<flux> ..256-line method? I think I found it as well ;)
jaar has quit [Quit: Quitte]
larhat1 has quit [Quit: Leaving.]
<Anarchos> flux there are three imbricated fucntions
<adrien> will try Condition tomorrow
<Anarchos> adrien what is condition ?
* adrien hates implementation-dependant stuff
<adrien> the module
<adrien> have to go
<adrien> I need semaphores (on windows)
edwin has joined #ocaml
edwin has quit [Client Quit]
<Anarchos> flux well the method is not 256 lines, but i have long pattern matching inside local functions definitions
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
ulgen has joined #ocaml
ulgen has left #ocaml []
mdelaney has quit [Quit: mdelaney]
mdelaney has joined #ocaml
mdelaney has quit [Client Quit]
BiDOrD has joined #ocaml
BiDOrD_ has quit [Ping timeout: 252 seconds]
Karboncode has quit [Remote host closed the connection]
lpereira has joined #ocaml
lopex has joined #ocaml
ftrvxmtrx has quit [Read error: Operation timed out]
ftrvxmtrx has joined #ocaml
sebz has joined #ocaml
avsm1 has quit [Quit: Leaving.]
_andre has quit [Quit: leaving]
ttamttam has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
lpereira has quit [Quit: Leaving.]
ttamttam has left #ocaml []
sebz has joined #ocaml
mnabil has joined #ocaml
ulfdoz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
thomasga has quit [Quit: Leaving.]
sebz has joined #ocaml
Guest94569 has joined #ocaml
Guest94569 has quit [Quit: ChatZilla 0.9.87 [Firefox 6.0.1/20110831234009]]
avsm has joined #ocaml
surikator has joined #ocaml
mnabil has quit [Remote host closed the connection]
_andre has joined #ocaml
DimitryKakadu has quit [Quit: Konversation terminated!]
ftrvxmtrx has quit [Quit: Leaving]
spearalot has quit [Quit: Computer has gone to sleep]
ulfdoz has quit [Ping timeout: 260 seconds]
surikator has quit [Read error: Connection reset by peer]
surikator has joined #ocaml
surikator has quit [Read error: Connection reset by peer]
surikator has joined #ocaml
seafood has joined #ocaml
avsm has quit [Quit: Leaving.]
ztfw has quit [Remote host closed the connection]
NaCl is now known as SpanishInquisitr
SpanishInquisitr is now known as NaCl
lopexx has joined #ocaml
lopex has quit [Ping timeout: 264 seconds]
ftrvxmtrx has joined #ocaml
lopexx has quit [Client Quit]
lopex has joined #ocaml
ikaros has quit [Quit: Ex-Chat]
avsm has joined #ocaml
seafood has quit [Ping timeout: 265 seconds]
Amorphous has quit [Ping timeout: 245 seconds]
_andre has quit [Quit: leaving]
Amorphous has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
avsm has quit [Quit: Leaving.]
jimmyrcom has quit [Ping timeout: 252 seconds]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
sebz has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]
wtetzner has joined #ocaml
sebz has joined #ocaml
eb4890 has quit [Ping timeout: 245 seconds]
dnolen has joined #ocaml
khia0 has joined #ocaml
khia0 has left #ocaml []
struktured has joined #ocaml
arubin has joined #ocaml
mdelaney has joined #ocaml
sebz has quit [Quit: Computer has gone to sleep.]