flux changed the topic of #ocaml to: Discussions about the OCaml programming language | http://caml.inria.fr/ | 3.11.0 out now! Get yours from http://caml.inria.fr/ocaml/release.html
<hcarty> jli: I've been bitten by that before as well. Glad you got it working.
<thelema> jli: you just need parentheses around (one,two)
<thelema> it's a parse issue, nothing more.
<jli> right
<jli> I was just expecting to be able to omit the parens, as in other cases with pairs
kaustuv has joined #ocaml
<thelema> yes, as I said, an issue with the parser.
alexyk has joined #ocaml
Associat0r has quit []
alexyk has quit [Client Quit]
<mrvn> jli: why not ommit the ,?
<jli> mrvn: not my type
<Alpounet> currying ?
<jli> huh?
travisbrady has quit []
<jli> I'd like to use Arg
<jli> but I'd like to use it to parse a string I already have, not a command line
<jli> I can't just split the string on spaces, because that won't handle quoting. any brilliant ideas?
<thelema> jli: is your string really in the form of a command-line?
<jli> thelema: my string's format is decidable by me. I can make it into a command-line.
ulfdoz has quit [Read error: 60 (Operation timed out)]
<jli> I just thought Arg would be a nice, clean way to parse it
<thelema> depends on what you need to do.
<thelema> if you can decide on the format, don't allow any quoting.
<jli> I can't decide that much
<jli> it needs to take an s-expression as an argument
<jli> actually. I guess I could just use more s-expressions...
<thelema> sexplib?
<jli> yup
<thelema> Turtles all the way.
<jli> yeah, this is a much better idea.
jeddhaberstro has joined #ocaml
komar_ has joined #ocaml
komar__ has quit [Read error: 113 (No route to host)]
loufoque has quit [Remote closed the connection]
<Alpounet> ++
Alpounet has quit ["Quitte"]
Ched has quit [Read error: 60 (Operation timed out)]
Ched has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
alexyk has joined #ocaml
<hcarty> mfp: 30+ for an OCaml posting on programming.reddit? Perhaps everyone has been sick today :-)
travisbrady has joined #ocaml
<palomer> +++
Mr_Awesome has joined #ocaml
jeddhaberstro has quit []
mbishop has quit [Read error: 110 (Connection timed out)]
mbishop has joined #ocaml
<jli> I don't understand why "let fn ?(opt1=default1) ?(opt2=default2) = ... in fn ()" doesn't work
<jli> well, I guess I actually do. you're passing it (), but that doesn't match anything. grrr.
<jli> hey, I can throw '()' at the end as a 3rd argument, whoo.
<jli> now it works, it's just ugly ):
<jli> :)
alexyk has quit []
alexyk has joined #ocaml
alexyk has quit []
alexyk has joined #ocaml
alexyk has quit []
travisbrady has quit [Read error: 104 (Connection reset by peer)]
travisbrady has joined #ocaml
alexyk has joined #ocaml
alexyk has quit [Client Quit]
ikaros has joined #ocaml
<palomer> yeah, we often throw () at the end of a sequence of label arguments
<palomer> (check out lablgtk)
Camarade_Tux has joined #ocaml
thelema has quit [Read error: 110 (Connection timed out)]
Ched has quit ["Ex-Chat"]
wng_z3r0 has joined #ocaml
Yoric[DT] has joined #ocaml
ikaros has quit ["Leave the magic to Houdini"]
jeanbon has joined #ocaml
m3ga has quit ["disappearing into the sunset"]
jeanbon has quit [Client Quit]
Yoric[DT] has quit ["Ex-Chat"]
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
wng_z3r0 has quit ["ChatZilla 0.9.84 [Firefox 3.0.10/2009042316]"]
schme has joined #ocaml
_zack has joined #ocaml
smimou has joined #ocaml
Yoric[DT] has joined #ocaml
thelema has joined #ocaml
m3ga has joined #ocaml
angerman has joined #ocaml
barismetin has joined #ocaml
_zack has quit [Read error: 113 (No route to host)]
Komar_ has joined #ocaml
_zack has joined #ocaml
robocop has joined #ocaml
<robocop> hello.
<robocop> do you know the best way to use commas number (like 12.1551) with module num ?
<flux> you mean rational number literals?
<robocop> (convert in the good string, like "121551/1000" ?)
<robocop> like this flux ? : "121551/1000"
<flux> seems like the way
<flux> I haven't really used the module
<robocop> okey, thanks.
<flux> too bad it doesn't support the fractional syntax, it seems
<flux> hm, actually, it does
<flux> what it doesn't support is the syntax with a decimal place
<robocop> okey, I will do this : http://paste.pocoo.org/show/120743/
<flux> looks like the same way I'd do it
<flux> function String.index does already exist, though
<flux> it raises an exception though, in the problem case..
<flux> (that is, no '.' found)
<flux> but in that case you could just return num_of_string s
<robocop> ha, yes, thanks.
smimou has quit ["bli"]
travisbrady_ has joined #ocaml
travisbrady has quit [Read error: 104 (Connection reset by peer)]
angerman has quit []
clog has joined #ocaml
schme has quit [Read error: 113 (No route to host)]
th5 has joined #ocaml
Komar_ has joined #ocaml
Komar_ has quit [Read error: 104 (Connection reset by peer)]
_zack has quit ["Leaving."]
komar_ has joined #ocaml
smimou has joined #ocaml
verte has quit ["~~~ Crash in JIT!"]
th5 has quit []
smimou has quit [Read error: 104 (Connection reset by peer)]
smimou has joined #ocaml
Ched has joined #ocaml
Axioplase has joined #ocaml
rjack has quit ["leaving"]
Ched has quit [Remote closed the connection]
Ched has joined #ocaml
Lomono has joined #ocaml
travisbrady has joined #ocaml
travisbrady_ has quit [Read error: 104 (Connection reset by peer)]
seafood has joined #ocaml
angerman has joined #ocaml
bombshelter13_ has quit [Client Quit]
bombshelter13_ has joined #ocaml
mattam has quit [hubbard.freenode.net irc.freenode.net]
rumbleca has quit [hubbard.freenode.net irc.freenode.net]
haelix has quit [hubbard.freenode.net irc.freenode.net]
Demitar has quit [hubbard.freenode.net irc.freenode.net]
mattam has joined #ocaml
rumbleca has joined #ocaml
Demitar has joined #ocaml
haelix has joined #ocaml
rumbleca has quit [hubbard.freenode.net irc.freenode.net]
haelix has quit [hubbard.freenode.net irc.freenode.net]
mattam has quit [hubbard.freenode.net irc.freenode.net]
Demitar has quit [hubbard.freenode.net irc.freenode.net]
mattam has joined #ocaml
rumbleca has joined #ocaml
Demitar has joined #ocaml
haelix has joined #ocaml
_andre has joined #ocaml
jeanbon has joined #ocaml
rjack has joined #ocaml
seafood has quit [Success]
ikaros has joined #ocaml
<Yoric[DT]> Does anyone know if asmdynlink is maintained ?
<kaustuv> Yoric[DT]: Damien Doligez says it's obsolete and not maintained.
<Yoric[DT]> ok
<Yoric[DT]> Thanks.
* Yoric[DT] wonders whether either ocamlrun (or better, the native code generator) has been ported to GPUs.
jknick has quit [Read error: 113 (No route to host)]
smimou has quit ["bli"]
travisbrady_ has joined #ocaml
travisbrady has quit [Read error: 104 (Connection reset by peer)]
Axioplase has quit ["Lost terminal"]
thelema has quit [Read error: 60 (Operation timed out)]
mikeX has joined #ocaml
mikeX has quit [Client Quit]
<flux> I doubt that kind of processing is suitable for GPUs
<Yoric[DT]> Well, nowadays, GPUs can do just about anything.
<flux> but are they good at doing it?
<flux> serially taking instructions and performing operations per that
<flux> I was under the impression the strengths of GPUs lied elsewhere
<Yoric[DT]> Not necessarily, but since you probably have at least one seriously unused GPU on your computer whenever you're running an OCaml application, might as well use it.
<Yoric[DT]> s/unused/underused/
<kig> gpus are pretty much parallel Array.init for 4-wide float vectors
<kig> 4-wide float vectors as the core of the instruction set
<kig> output floats or half-floats or unsigned bytes in widths from 1 to 4
<kig> the AMD R600 / 700 docs are interesting :]
<kig> http://www.x.org/docs/AMD/ R6xx_R7xx_3D.pdf and r600isa.pdf
travisbrady_ has quit []
<mrvn> I would rather port sync_xor and sync_sha to the gpu to handle disk I/O.
<mrvn> raid and crypto.
Axioplase has joined #ocaml
Axioplase has quit [Client Quit]
Axioplase has joined #ocaml
Axioplase has quit [Client Quit]
Axioplase has joined #ocaml
ikaros has quit [Read error: 110 (Connection timed out)]
duaneb has joined #ocaml
<duaneb> hi ocamlers
<Yoric[DT]> hi
BrianRice has joined #ocaml
<duaneb> why is there no unicode support in ocaml? :(
<duaneb> it makes me sad....
<gildor> duaneb: there is unicode support in ocaml
<Yoric[DT]> There are several ways of getting this support.
<duaneb> well, yes, through libraries
jamii has joined #ocaml
<Yoric[DT]> Indeed.
<duaneb> but I feel like at least supporting UTF-32 internally and then having encoding support would be fairly straightforward
<Yoric[DT]> One of these being Batteries Included, which attempts to replace the standard library.
willb has quit ["Leaving"]
mpwd has joined #ocaml
barismetin has quit [Read error: 110 (Connection timed out)]
<duaneb> so
<duaneb> is there a manual somewhere for the ocaml repl?
<duaneb> I'm trying to figure out things like type signatures
* Yoric[DT] has to go.
<Yoric[DT]> Cheers.
<Yoric[DT]> (and there's a manual at http://www.ocaml.org )
Yoric[DT] has quit ["Ex-Chat"]
<mrvn> Anyone here know what it takes to get a patch into ocaml upstream? I want to export some C functions of the Unix module for other C stubs.
<Jedai> duaneb: The ocaml repl by itself is pretty useless... You must wrap it in a readline input handler or use it in Emacs (with the tuareg mode) for it to be ok.
<duaneb> :|
<duaneb> sigh.
travisbrady has joined #ocaml
<duaneb> I miss hugs :P
<duaneb> and ghci
* brendan loves tuareg
<Jedai> duaneb: well the good point of the OCaml repl is that you can write everything in it you could write in a real ocaml program
<duaneb> I suppose :P
<duaneb> but I can't view type signatures?
<duaneb> meh....
<Jedai> duaneb: it should be displayed after you define a function
<Jedai> duaneb: and if you just put a value ;; on the prompt, you'll get its type too
<gildor> mrvn: what C functions ?
<flux> duaneb, you may be interested in EnhTop
willb has joined #ocaml
<gildor> duaneb: ocaml support ASCII internally and have fairly straightforward encoding support
<flux> duaneb, but if emacs+ocaml is a pretty neat combination :)
|Lupin| has joined #ocaml
<|Lupin|> hello everyboddy
<gildor> duaneb: this is just a question of choosing of choosing the most easy standard to implement as "pivot" (i.e. ASCII)
<|Lupin|> I'm wondering how to write an OCaml module that extends an existng one.
<gildor> duaneb: but in fact you should consider char as byte and string as array of byte
<gildor> |Lupin|: module TotoExt = struct include Toto let fext = ... end
<|Lupin|> So if m1.ml and m1.mli exist, what to write in m2.ml and m2.mli such that if t is a type defined in M1, it is available as M2.t, and the same for values
<gildor> use "include M1"
<gildor> (it works for sure for m2.ml, you need to test for m2.mli)
<|Lupin|> gildor: yes precisely, it does not work in the mli so I am wondering how to do... open in the .mli does not work either...
Alpounet has joined #ocaml
<julm> |Lupin|: you can add your vote to http://caml.inria.fr/mantis/view.php?id=3013 to make ocaml{c,opt} able to use .cmi as a module type
<|Lupin|> julm: thanks a lot for the pointer. Too bd it is not possible yet...
<duaneb> flux: emacs is OK, but it requires dedication
<duaneb> gildor: yea, but might as well use UTF-32 instead of ascii.
<duaneb> and then you don't need to worry about ignoring hundreds of thousands of characters
<gildor> gildor: ASCII (and in fact byte) works for text and binary
<gildor> duaneb: i mean
<|Lupin|> Enter the code as it is shown in the box on the right.: _____ [INLINE]
<|Lupin|> hmm the anti-spam protection of the bug tracker prevents me from signing up... too bad...
<gildor> duaneb: this allow to manipulate a lot more data that just UTF-32
<gildor> duaneb: all in all it is a better pivot
<gildor> (for binary at least)
<gildor> |Lupin|: so you are probably stuck to rewrite m2.mli using m1.mli (I encounter this situation from time to time and don't like it neither)
<|Lupin|> gildor: yes, that's what I'll do...
<|Lupin|> gildor: I've sent an e-mail to the caml-list, though...
<|Lupin|> who knows, maybe it's gonna wake up people...
<mrvn> gildor: conversion between errno and Unix.Error
<|Lupin|> gildor: actually copying the .mli works just fine. It's awful, sure, but it works...
<gildor> mrvn: what is the function name ?
<|Lupin|> CU later, everybody
|Lupin| has left #ocaml []
ikaros has joined #ocaml
<mrvn> unix_error_of_code
<mrvn> int error_table[] = {
ikaros has quit [Read error: 104 (Connection reset by peer)]
<mrvn> gildor: I actually need code_of_unix_error, the reverse of unix_error_of_code()
Yoric[DT] has joined #ocaml
jeanbon has left #ocaml []
<mrvn> gildor: even more specific I want to call an ocaml function from C, catch a possible exception and return the respective -errno.
Axioplase has quit ["/quat"]
sporkmonger has joined #ocaml
<mrvn> gildor: I figure I also need an let _ = Callback.register_exception "caml unix exception" (Unix.Unix_error ...)
<mrvn> nm, that one is in unix.ml already
<mrvn> Args, I just noticed something:
<mrvn> type stats = Unix.LargeFile.stats =
<mrvn> { st_dev : int; (** Device number *)
<mrvn> st_ino : int; (** Inode number *)
<mrvn> Inodes are 64bit.
julm has quit [Read error: 60 (Operation timed out)]
julm has joined #ocaml
<gildor> mrvn: since you need to go through an ocaml function why don't you catch the exception and do what is needed, there !
<gildor> (i.e. in ocaml rather than in C)
<mrvn> gildor: How to I get the C errno from Unix.error in ocaml?
<mrvn> It doesn't really matter where I catch the exception. The problem of converting remains. And I must have a C stub while the ocaml function is user supplied. So catching it in C saves a function call.
<flux> mrvn, for throwing unix errors there's a function somewhere in ocaml
<flux> that is, converting errnos to errors
<mrvn> flux: not throwing, catching.
<flux> mrvn, well, surely something like Unix.read would make use of such a function?
<mrvn> flux: no, Unix.read THROWS the exception.
<flux> yes..
<flux> mrvn, or you have C code that catches ocaml-code throwing an exception and you want to interpret that?
<mrvn> The ocaml code throws Unix.ENOENT, my C code catches that and return -ENOENT to libfuse.
<flux> hmm, ok
<flux> I suppose you need to make use of the tables ocaml has, then
<mrvn> Which means return -error_table[Int_val(unix_error)];
<flux> or brutally provide means to map that information back some other way, say, by generating code during ./configure :)
<mrvn> flux: The table isn't exported in unixsupport.h.
<flux> mrvn, make a copy of the table, then?
<mrvn> flux: who says that will match on the next ocaml update?
<flux> or, generate a similar table during ./configure
<flux> it does suck that ocaml doesn't provide proper interfaces for doing that kind of stuff in C
<flux> maybe a bug report should be filed :)
<mrvn> I've added an "extern int code_of_unix_error (value error);
<mrvn> " to unixsupport.h/c now. Going to test that and then file a bug+patch.
<flux> are you going to write a workaround? of course, doesn't matter if only a few people have access to the code to begin with
<mrvn> flux: That depends on how long it takes to get a patch into ocaml.
<gildor> mrvn: exception Unix_error of error * string * string
rjack has quit ["leaving"]
<gildor> mrvn: so you catch Unix_error(err, _, _), and err is an int value (exception if its EUNKNOWNERR)
<mrvn> gl: No, err is an Unix.error
<gildor> mrvn: first step Unix_error -> error as an entry in error_table
<mrvn> gildor: the problem is that the int value of Unix.ENOENT != C ENOENT
<gildor> err is a "Int_val" if your prefer
<mrvn> error_table is private
<gildor> then you go throuhg error_table to find the right entry
<gildor> extern error_table, just as in errmsg.c
Camarade_Tux has quit ["Leaving"]
<mrvn> gildor: does that work outside the unix.cmxa? I would expect the symbol to be hidden.
<gildor> mrvn: i think you can live without patch for this specific problem
<gildor> mrvn: test it, but I think it should be ok
<gildor> mrvn: it would be a problem if there is name clas with other definition
<gildor> (which can indeed exist)
<gildor> clas -> clash
<mrvn> Even if it works nothing says it will work in 3.12. So eventually a patch is needed.
<gildor> mrvn: just try it, it can work and allow you to not bother with a patch
<mrvn> gildor: how do I get the size of the table?
<mrvn> (just to be paranoid andavoid the risk of looking up a value out of bounds)
<gildor> sizeof(error_table) / sizeof(*error_table) ?
<mrvn> gildor: on an extern int error_table[]?
<gildor> why not ;-)
<gildor> (but this is ugly and it is not sure that it works)
<mrvn> hmm, extern int error_table[];
<mrvn> void foo() { int i = sizeof(error_table) / sizeof(*error_table); }
<mrvn> foo.c:2: error: invalid application of 'sizeof' to incomplete type 'int[]'
<flux> it won't work.
<mrvn> WOuld have surprised me if it did.
Yoric[DT] has quit ["Ex-Chat"]
<flux> well, if you just _know_ that err will always be from that table, you don't need to know its size?
<flux> so err is an index to that table, simply index it to get your original code?
_andre has quit ["leaving"]
<mrvn> flux: Should be save.
<flux> I wonder though what does that EUNKNOWNERR in comments mean
<flux> does it actually use that value whenever it finds an unknown (to ocaml) error?
<flux> while the code suggests it uses -1
<mrvn> flux: That one is EUNKNOWNERR of int, so it is a block containing the errnor directly.
<flux> ah, so you would need to handle that special case
<mrvn> err = alloc_small(1, 0);
<mrvn> Field(err, 0) = Val_int(errcode);
<flux> but quite easy too
<mrvn> if (Is_block(error)) {
<mrvn> return Int_val(Field(error, 0));
<mrvn> } else {
<mrvn> return constr_to_cst(error, error_table, sizeof(error_table)/sizeof(int), -1);
<mrvn> }
<flux> yeah, missed that, looked only at the call to constr_to_cst
<mrvn> and constr_to_cst just looks up the table value.
Amorphous has quit [Read error: 104 (Connection reset by peer)]
<flux> well, everything should be solved, then?
<flux> I don't think this means that ocaml _shouldn't_ still provide better facilities for doing this stuff..
<mrvn> flux: sure. the patch is all ready. I'm just waiting for the compile to finish.
<flux> mrvn, but you still need the patch?
<flux> (or rather: why do you still need..)
<mrvn> flux: to make it official. I hate just using "extern int error_table[];"
robocop has left #ocaml []
Amorphous has joined #ocaml
duaneb has left #ocaml []
smimou has joined #ocaml
julm has quit [Read error: 110 (Connection timed out)]
julm has joined #ocaml
kaustuv has quit [Read error: 60 (Operation timed out)]
komar__ has joined #ocaml
komar_ has quit [Read error: 113 (No route to host)]
Snark_ has quit ["Ex-Chat"]
komar_ has joined #ocaml
komar__ has quit [Read error: 113 (No route to host)]
hkBst has quit [Read error: 104 (Connection reset by peer)]
schme has joined #ocaml
komar_ has quit [Remote closed the connection]
alexyk has joined #ocaml
holgr has quit [Remote closed the connection]
holgr has joined #ocaml
barismetin has joined #ocaml
BrianRice has quit []
sporkmonger has quit [Read error: 110 (Connection timed out)]
smimou has quit ["bli"]
schme has quit [Read error: 113 (No route to host)]
bombshelter13_ has quit []
alexyk has quit []
angerman has quit []
* palomer wonders where camarade_tux ran off to
<mrvn> hiding from swine flu?
m3ga has joined #ocaml
<palomer> hrmph
sporkmonger has joined #ocaml
sporkmonger has quit []
Camarade_Tux has joined #ocaml
Yoric[DT] has joined #ocaml
willb has quit [Read error: 113 (No route to host)]
Camarade_Tux has quit ["Leaving"]
maxote has quit [Connection timed out]
m3ga has quit [hubbard.freenode.net irc.freenode.net]
acatout has quit [hubbard.freenode.net irc.freenode.net]
acatout has joined #ocaml
barismetin has quit [Remote closed the connection]
bohanlon has quit [hubbard.freenode.net irc.freenode.net]
bohanlon has joined #ocaml
Yoric[DT] has quit ["Ex-Chat"]
m3ga has joined #ocaml