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
ftrvxmtrx has quit [Quit: Leaving]
<thelema> hmm
<thelema> I think if oasis provided an easy command to get deps from a _oasis file, it'd be better to just auto-install oasis when needed
<thelema> I don't really like the idea of having an odb-full, at least not one I maintain.
<hcarty> If oasis doesn't have/add that, it may be an easy enough thing to create and make odb-installable
<hcarty> That may be awkward at some point. But it would keep odb's size and direct dependencies down.
<hcarty> s/may be/may get to be/
iago has quit [Ping timeout: 245 seconds]
Tobu has quit [Ping timeout: 272 seconds]
Tobu has joined #ocaml
iago has joined #ocaml
smerz has quit [Remote host closed the connection]
<thelema> maybe the better solution is still to "good-enough" parse _oasis files
<thelema> although this gets tricky with multiple sections
ulfdoz_ has joined #ocaml
ulfdoz has quit [Ping timeout: 245 seconds]
ulfdoz_ is now known as ulfdoz
iago has quit [Ping timeout: 244 seconds]
iago has joined #ocaml
curryboy has quit [Quit: leaving]
iago has quit [Quit: Leaving]
tomodo has joined #ocaml
<tomodo> does anyone like to collab with me on writing a boardgame with gtk?
<tomodo> (i guess not lol but why not ask)
dsheets has joined #ocaml
Fnar has joined #ocaml
Fnar has quit [Changing host]
Fnar has joined #ocaml
tautologico has quit [Quit: tautologico]
emmanuelux has quit [Read error: Connection reset by peer]
eni has joined #ocaml
ggherdov has joined #ocaml
<tomodo> hi
<tomodo> what should I use to draw SVGs on top of each other?
<tomodo> I have this example code which puts my background svg up in a window using Rsvg.render_from_file ~gz ?dpi:!dpi ?size_cb !fname
<tomodo> but now I want to put pieces on top of it (separate svg files)
<tomodo> I get weird errors
<tomodo> This expression has type GMisc.image but an expression was expected of type Gdk.image
eni has quit [Quit: Leaving]
<tomodo> I am lost :(
<tomodo> this helps
hto_ has quit [Quit: leaving]
eni has joined #ocaml
ftrvxmtrx has joined #ocaml
err404 has joined #ocaml
ygrek has joined #ocaml
Snark has joined #ocaml
ulfdoz has quit [Remote host closed the connection]
ulfdoz has joined #ocaml
BiDOrD_ has joined #ocaml
BiDOrD has quit [Ping timeout: 276 seconds]
munga has joined #ocaml
Tobu has quit [Ping timeout: 272 seconds]
hto has quit [Quit: leaving]
hto has joined #ocaml
GPHemsley has quit [Ping timeout: 265 seconds]
pango has quit [Quit: Client exiting]
eni has quit [Ping timeout: 245 seconds]
pango has joined #ocaml
Tobu has joined #ocaml
<flux> great.. now that I finally check out the jpeg files from my v4l2 capture code, I realize they don't work :). probably they are missing a header..
<flux> also I realize that indeed all v4l2 code in the web is based on the same example :)
<adrien> :p
tomodo has quit [Quit: Lost terminal]
untroubled has joined #ocaml
ftrvxmtrx has quit [Quit: Leaving]
<Ptival> what's the lightweightest way to have a bidirectional mapping between a variant constructors and integers?
<adrien> define "light"
<adrien> code size, programmer time, efficiency, ... ?
<Ptival> programmer time
<thelema> Obj.magic
<Ptival> thelema: I need a specific mapping
<Ptival> not an arbitrary one based on constructor position
ftrvxmtrx has joined #ocaml
<Ptival> I should probably just use an association list
<flux> I've used association lists
<flux> too bad the compiler cannot tell me when I haven't enumerated them all
<Ptival> oh there's not even the reverse assoc in list.ml...
<adrien> reverse assoc?
<adrien> bi-directional lookup?
<flux> I just create a list both ways :) (one is generated from the other)
<Ptival> adrien: yes bidirectional lookup
<thizanne> Ptival: List.find should do the job ?
<Ptival> right
<Ptival> huh this will be annoying to define
<Ptival> I need to do this for lots of variants :D
<companion_cube> why not couple two maps, for your bidirectional binding,
<companion_cube> ?
<thizanne> let rev_assoc x = List.find (fun (a, b) -> b = x)
<thizanne> add fst if you just want the mapped element and it should work, no ?
<Ptival> companion_cube: I could
<Ptival> I still need to define the pairs
<Ptival> and I also want one variant to cover "all the other integers"
<Ptival> so I'll need to write down one lookup function per variant...
<Ptival> per variant type I mean
<thizanne> map your variants to an int option
<thizanne> and redefine your assoc functions to consider that None maps to everything
<flux> actually I used a function like: let (bar_of_int, int_of_bar) = mk_lookup [(1, `A); (2, `B)] etc
<Ptival> somthing along those lines
munga has quit [Ping timeout: 244 seconds]
<flux> how do I write a string into a file the easiest way in batteries?
<flux> I used BatFile.write_lines first, but then I realized that it of course appends \n to the end of my string
<flux> heh, perhaps I should've looked at batStd.mli first, output_file..
<flux> I should start adding cross-reference-documentation to batteries ;)
<ygrek> deriving!
<flux> I wonder why libjpeg just cannot by default use the default huffman decoding table if it's missing
<flux> that way 'all' jpeg-applications would automagically also support mjpeg images
<mrvn> flux: Isn't there a BatFile.write?
<mrvn> flux: What would an mjpeg look like in the app then? Just the first frame?
<flux> nope, just write_lines, at least in my (oldish) version of batteries
<flux> mrvn, mjpeg doesn't require more than one frame..
<flux> my camera has this streaming mode and each frame, mjpeg, is just a jpeg file but without the (standard) huffman table
<flux> if instead of bailing out libjpeg used the standard huffman table, everything would be nice :)
<mrvn> What is a stadard huffman table? All byte code equally probable?
<flux> no, the jpeg standard has the tables
<mrvn> ahh, didn't know that.
<mrvn> flux: send patch. :)
<flux> meh, my v4l2 code can handle the situation ;)
ftrvxmtrx has quit [Ping timeout: 272 seconds]
Tobu has quit [Ping timeout: 272 seconds]
GPHemsley has joined #ocaml
GPHemsley has quit [Changing host]
GPHemsley has joined #ocaml
Tobu has joined #ocaml
smerz has joined #ocaml
flapjackery has joined #ocaml
flapjackery has left #ocaml []
<flux> can I call alloc_bigarray_dims when I have released the ocaml global gc lock?
avsm has joined #ocaml
<flux> or can I convert a regular pointer into a bigarray value..
<adrien> isn't the rule that you must only avoid allocations?
<adrien> or anything that can trigger an allocation?
<flux> well, is that going to do some ocaml memory allocation?
emmanuelux has joined #ocaml
<flux> or is it completely out of ocaml heap?
<adrien> good question ;p
eni has joined #ocaml
<mfp> flux: caml_ba_alloc_dims (= alloc_bigarray_dims) does allocate the custom block representing the bigarray in the ocaml heap
<flux> mfp, how about the conversion?
<flux> I suppose I can just caml-allocate caml_ba_array with the proper tags etc
<mfp> the conversion?
<flux> if I want to have C code allocate stuff, and then once it has done it, put those pointers into a bigarray
<flux> basically release_gc_lock(); heavy/blocky stuff here involving allocating stuff eventually retunred to caml(); release_lock(); make_bigarrays_out_of_those_pointers();
<flux> the second release_lock should obviously be acquire_gc_lock() :)
<flux> (or caml runtime system lock it's called)
<mfp> caml_ba_alloc_dims is CAMLexport value caml_ba_alloc_dims(int flags, int num_dims, void * data, ...)
<mfp> so you can allocate the data block w/o having the lock, and only reacquire to make the bigarray, as you said
<flux> heh, I've completely glossed over that parameter :-)
<mfp> hmm in that case the block is not considered CAML_BA_MANAGED and you'll have to release manually (say with a finaliser)
<flux> oh, that's downside
<mfp> according to bigarray_stubs.c:caml_ba_alloc
<flux> can I just switch the managed-bit on?
<flux> I suppose it wouldn't work that way
<mfp> oh my bad
<mfp> right, you can just give the flag
<mfp> then it'll free in caml_ba_finalize
<mrvn> Why not allocate the bigarray and only then release the lock?
<mfp> maybe he doesn't know the dimensions?
<mrvn> once he does, get the lock, alloc, free lock
<flux> mrvn, well, it's better not to block on acquiring the lock?
<mrvn> how often do you alloc a bigarray?
<flux> just once, after reading the jpeg header
<mrvn> so hardly a performance issue to get the lock there
<flux> probably not, especially as the jpeg is being read from memory
<flux> (meaning I could just postbone the lock releasing)
<mrvn> have you looked at sdl? It can load images and give you an bigarray of the pixel values :)
<flux> I thought it gives Sdl.surfaces?
ggherdov has quit [Ping timeout: 265 seconds]
<flux> hmm, but it does have a generic pixel_data way to 'convert' surfaces to Bigarrays
<flux> in any case, I'll only add those lock releases when I get to the point I want to use multiple threads with this..
<flux> it seems data analysis phase is where the time is spent at, not decoding jpeg files.
<mrvn> flux: that is short sighted. If you only have one thread they don't cost you and later you will forget.
<flux> I can easily later see if I'm using 200% cpu or not :)
ftrvxmtrx has joined #ocaml
<flux> I would rather say it's short-sighted to optimize something that might not ever be beneficial.
<mrvn> flux: oehm, if you release the lock and then allocate things will crash. If you start then you have to do it right.
<flux> obviously I'm not going to release any locks now and suffer the small cost of not interleaving C code with ocaml threads
<adrien> two worker processes?
<flux> I have one process, one thread. in future I might have more threads of execution, and I probably must use ocaml processes to do that
<flux> (because the analysis is in ocaml and that's the bottleneck by far)
avsm has quit [Quit: Leaving.]
<adrien> building GCC, so much fun
<adrien> I couldn't run gentoo
mjonsson has joined #ocaml
Drakken has quit [Ping timeout: 260 seconds]
mjonsson has quit [Quit: Leaving]
Drakken has joined #ocaml
tester54 has joined #ocaml
tester54 has quit [Remote host closed the connection]
ikaros has joined #ocaml
Tobu has quit [Ping timeout: 248 seconds]
Tobu has joined #ocaml
struktured has joined #ocaml
<ousado> are there any known issues with ocaml on osx leopard?
<ousado> installed from macports?
digcon9 has joined #ocaml
digcon9 has quit [Read error: Connection reset by peer]
digcon9 has joined #ocaml
digcon9 has quit [Ping timeout: 252 seconds]
Anarchos has joined #ocaml
ggherdov has joined #ocaml
snearch has joined #ocaml
<orbitz> what does this mean: type (-'a, -'b) event_listener
eni has quit [Ping timeout: 244 seconds]
<mrvn> orbitz: the - means contravariant or so
<orbitz> Hrm what does that mean for the code?
<orbitz> Is it for the objective peice of Ocaml?
<mrvn> Not sure exactly what - does. But the opposite +'a allows to define values that are polymorphic like []
<pippijn> orbitz: you're everywhere..
<orbitz> stop following me!@
<mfp> orbitz: it means that given ('a, 'b) event_listener and ('c, 'd) event_listener, the latter is a subtype of the former if 'a is a subtype of 'c and 'b a subtype of 'd
<orbitz> Does that apply to object system adn polymorphic variants only?
<orbitz> I'm not srue what else can be subtypted...
<mrvn> orbitz: applies to any abstract type
<mrvn> anything with 'a that doesn't reveal the details
<mfp> orbitz: the base cases are those you mention (I can think of any else), but then you expand subtyping recursively to other abstract types, the above event_listener being an example of one
<mfp> so you'd do (x : (c, d) event_listener :> (a, b) event_listener) in that example
snearch has quit [Quit: Verlassend]
ggherdov has quit [Ping timeout: 265 seconds]
GPHemsley has quit [Ping timeout: 252 seconds]
GPHemsley has joined #ocaml
GPHemsley has quit [Changing host]
GPHemsley has joined #ocaml
ikaros has quit [Remote host closed the connection]
ygrek has quit [Quit: Leaving]
munga has joined #ocaml
eni has joined #ocaml
pippijn has quit [Ping timeout: 252 seconds]
eni has quit [Quit: Leaving]
Snark has quit [Quit: Quitte]
fooc has quit [Ping timeout: 240 seconds]
eni has joined #ocaml
err404 has quit [Remote host closed the connection]
fooc has joined #ocaml
<thizanne> mrvn: type -'a t means that, if you have type a and b, and a < b, then a t > b t
<thizanne> and you could apply it to a concrete type
<_habnabit> what does it mean for a type to be greater than another type
<thizanne> (ocaml will then check it's really contravariant and it will have no more effect because it already know it)
<thizanne> _habnabit: a < b means that, if you have a function who can take a value of type b, then it can take value of type a
<_habnabit> ah
<thizanne> for an example, list is covariant
<thizanne> because if a < b, then a list < b list
fooc has quit [Read error: Operation timed out]
<thizanne> Array is covariant for reading and contravariant for writing
eni has quit [Quit: Leaving]
<thizanne> practically, in ocaml, you only can have subtypes with objects
fooc has joined #ocaml
milosn has quit [Read error: Connection reset by peer]
milosn has joined #ocaml
milosn has quit [Ping timeout: 245 seconds]
pippijn has joined #ocaml
pippijn has quit [Changing host]
pippijn has joined #ocaml
fooc has quit [Ping timeout: 276 seconds]
milosn has joined #ocaml
fooc has joined #ocaml
fooc has quit [Ping timeout: 246 seconds]
fooc has joined #ocaml
tautologico has joined #ocaml
<Ptival> let module M = match foo with | A -> (val MA : Msig) | B -> (val MB : Msig) in (* ... *)
<Ptival> what's the proper syntax for something along these lines?
mmajchrzak has joined #ocaml
mmajchrzak has quit [Read error: Connection reset by peer]
<Anarchos> Ptival no idea if it is feasible
avsm has joined #ocaml
<Ptival> oh, found it I think
<thizanne> Anarchos: it actually is from 3.12
<Anarchos> thizanne ah ok ; i am on 4.01.0+dev2_2012-04-17
<thizanne> so it's feasible :)
fooc has quit [Ping timeout: 265 seconds]
fooc has joined #ocaml
wtetzner has joined #ocaml
<Ptival> well, now maybe I'm oversyntaxing it
<Ptival> ♥ subtyping annotations ♥
fooc has quit [Ping timeout: 244 seconds]
fooc has joined #ocaml
<Ptival> guess you need it all actually
<Ptival> in the most general case at least
<pippijn> hm
untroubled has quit [Quit: leaving]
<pippijn> that's a very very interesting project
<pippijn> I'm going to need that someday
<pippijn> I was not looking forward to implementing it
notk0 has joined #ocaml
<notk0> could someone explain to me this code please: http://pastebin.ca/2151164
<notk0> I don't understand how the filter is valid, since it is executed on the list before giving it to map
<notk0> range 1 n gives [1;2;3..n];;
<notk0> wait I understand that is the argument value nevermind
notk0 has quit [Client Quit]
Anarchos has quit [Quit: Vision[0.9.7-H-090423]: i've been blurred!]
avsm has quit [Quit: Leaving.]
munga has quit [Ping timeout: 252 seconds]