<det>
I have never used it myself, so I can't comment on the practicality of it
<det>
although Jane St. seems real-world-oriented
<palomer>
why is it a nicer solution?
angerman has joined #ocaml
<palomer>
hrmph
<palomer>
where's the API documentation for sexp
<mrvn>
The compiler should have a signature : 'a -> string or 'a -> Hash.t although I don't know how it could implement it.
angerman has quit []
<mrvn>
astronut: match (foo, bar) with ....
<palomer>
wait a minute
<palomer>
ocaml DOES have ad-hoc polymorphism
<palomer>
look at <
<palomer>
3 < 4
<palomer>
"foo" < "bar"
<mrvn>
palomer: The signature of 'type foo = Foo' and 'type Bar = Bar' should differ while their strcuture is the same. How do you implement 'let f x = Printf.printf "%s" (signature x)'?
<mrvn>
< just compares the structure.
<palomer>
ah
<palomer>
< is like =
<palomer>
any other structural operators?
<mrvn>
> == != <>
<mrvn>
marshal too
tripwyre has joined #ocaml
angerman has joined #ocaml
tarbo2 has quit [Connection timed out]
sgnb` is now known as sgnb
tarbo2 has joined #ocaml
kaustuv has quit [Remote closed the connection]
kaustuv has joined #ocaml
pseudosaint has joined #ocaml
pseudosaint has left #ocaml []
seafood has joined #ocaml
olegfink has quit [Remote closed the connection]
olegfink has joined #ocaml
olegfink has quit [Operation timed out]
olegfink has joined #ocaml
bdc334 has quit ["using sirc version 2.211+KSIRC/1.3.12"]
<astronut>
mrvn: oh, right
<astronut>
i ended up doing something better
<astronut>
i don't see anything in pervasisves - is there a built in function 'a option -> 'a that just strips the option?
<palomer>
I don't think so.
<palomer>
I've written my own:
<palomer>
let from_some x = match x with
<palomer>
| (Some a) -> a
<palomer>
| None -> raise (Failure "from_some on none")
Alpounet has joined #ocaml
<astronut>
palomer: right, i just feel like it's common enough that it ought to be included
<palomer>
the ocaml standard library is quite datatype poor
<palomer>
there isn't even an either datatype!
<palomer>
anyways, you can use extlib
<palomer>
Option.get
<palomer>
extlib...everyone's doing it!
<Alpounet>
and Batteries ! :-)
palomer has quit [Remote closed the connection]
Camarade_Tux has joined #ocaml
alexyk has quit []
sgnb has quit [Read error: 104 (Connection reset by peer)]
sgnb` has joined #ocaml
<mrvn>
patronus: whatis an either?
<mrvn>
type ('a, 'b) either = This of 'a | That of 'b ??
<mattam>
Yes.
seafood has quit [Read error: 110 (Connection timed out)]
<Alpounet>
brb
Alpounet has quit ["Quitte"]
Alpounet has joined #ocaml
* olegfink
would prefer a 'a option -> 'a version of from_option to a variant raising an exception
<olegfink>
er, 'a option -> 'a -> 'a
<olegfink>
ah, it's called default in extlib
<mrvn>
let default def = function None -> def | Some x -> x
<Alpounet>
olegfink, why ?
<mrvn>
olegfink: write a patch and send it in. Or doesn't upstream accept extensions like that?
<olegfink>
mrvn: patch for what?
<olegfink>
I'm happy with extlib's implementation, and inria's library doesn't have either version
<mrvn>
olegfink: for your default
<olegfink>
Alpounet: because this is what you would probably do in a try..with anyway, and in mch less code
<olegfink>
*much
<mrvn>
olegfink: no, you pattern match. no point raising and catching an exception
<olegfink>
mrvn: my default should be similar to extlib's one, the order of arguments in mine is due to me haven't waken up completely.
<olegfink>
mrvn: i was referring to the difference as seen between extlib's Option.get and Option.default
<mrvn>
olegfink: to me it seems better to have the default before the option argument. That way you can create a "default 0" value and use it for multiple options.
<mrvn>
But thats just spur of the moment thinking.
<olegfink>
sure, that's how all the default-like implementations I've seen look like (Option.default and Data.Maybe.fromMaybe)
<olegfink>
false.
<olegfink>
val get : 'a option -> 'a
<olegfink>
er, sorry.
<olegfink>
mrvn: what is inria's policy on library extensions?
<mrvn>
no idea, never tried
<mrvn>
I would like to know though.
<olegfink>
batteries (or extlib) might be too heavy, but i'd really like some of the functions that are always defined in >5 loc programs to join the stdlib
<mrvn>
yeah. Get the features in one line at a time. small, non objectionable changes.
<olegfink>
heh, on of the main strangths of ocaml is that it has only one implementation. but it compensates that with a wide choice of foundation libraries!
<olegfink>
by the way, what can be told about -vmthread implementation (or just a pointer to the place in byterun it's implemented in)?
dima2001 has joined #ocaml
<mrvn>
Is anyone working on a multithreaded GC?
<mrvn>
i.e. actual concurrent threads for ocaml.
<olegfink>
afaik that was a jssp project?
<olegfink>
no, i'm after this particular implementation in bytecode
<mrvn>
So it would be better to put all values into a ocaml record and register than as one root instead of each value.
<mrvn>
This is for fuse bindings. So for every filesystem you implement in your code you would get one extra root then. Should be fine. :)
<flx_>
mrvn, fixing the existing fuse bindings to beginning from the ground up?
<mrvn>
flx_: I'm binding the low level functions. I've only found 2 implementations for the high level functions.
<olegfink>
mrvn: what about trying dlopen? :-)
<flx_>
mrvn, so new bindings then?
<mrvn>
flx_: yep
<mrvn>
olegfink: huh?
<flx_>
mrvn, what do you seek to gain advantage on?
<mrvn>
flx_: I want to use the low level functions.
<mrvn>
fuse has 2 interfaces, one high level that works on full paths and one low level that works on inode numbers. I just need the inode one for my FS.
<flx_>
mrvn, and the high level ones can be implemented in the terms of low level ones?
<mrvn>
flx_: could be. but fuse already does that.-
<flx_>
mrvn, in any case, that's great. I remember looking at the original fuse bindings way back when they were new, and they were path based, which doesn't work 100% with unix semantics
<mrvn>
olegfink: how does that help me write the stubs for the bindings?
<flx_>
mrvn, yes, but the high level interface would be better if it is implemented in ocaml :-)
<flx_>
olegfink, please, do run ocamldoc :)
<olegfink>
mrvn: you don't have to.
<mrvn>
flx_: not sure about that. You would want the high level C and ocaml interfaces to behave identical.
<olegfink>
flx_: i'm lazy, does it have a markdown backend? (i want the reference to be in the wiki)
<mrvn>
olegfink: yes I do. I have to interface ocaml closures with C callbacks.
<flx_>
mrvn, why? isn't the point to implement file systems in ocaml, not necessarily with the same exact translated C code..
<flx_>
olegfink, I don't remember
<mrvn>
flx_: then it would be a 3rd interface.
<flx_>
quite possible it doesn't
Associat0r has quit [Read error: 104 (Connection reset by peer)]
verte has joined #ocaml
<mrvn>
flx_: My goal is to combine libfuse with libaio in my filesystem and run single threaded. libaio to make disk access non-blocking. Since ocaml can't run two threads in parallel I see little point in forking a thread for every filesystem operation.
<flx_>
mrvn, I think that is likely more efficient also
<mrvn>
Esspecially if the data is already cached in the filesystem.
<mrvn>
Creating a thread thatjust looks up something in a hashtbl must have a huge overhead.
<mrvn>
I can also do without locks for the data structures. At least I hope so.
<olegfink>
mrvn: indeed you have to then.
<mrvn>
have to what?
<olegfink>
write stubs.
<mrvn>
:)
* olegfink
wonders if it's possible at all
<mrvn>
to automatically generate stubs for callbacks?
<olegfink>
at least Marshal can tell us the position of a function in the code to 'serialize' it
<olegfink>
no, to not do any stubs at all and pass closures to C code
<mrvn>
olegfink: trivial
<olegfink>
yes?
<mrvn>
18.7.2 Registering Caml closures for use in C functions
<mrvn>
let _ = Callback.register "test function" f
<mrvn>
It only gets complicated when you need to do that dynamically.
<olegfink>
i am going to do that dynamically, but i think this can be adapted to dlopen, thanks.
<olegfink>
hrm
* olegfink
is confused
<mrvn>
You need to be able to pass a callback AND some private data to the C code. In the private data you record the ocaml closure you need to call and as callback you pass some C code that extracts the closure and calls it.
<olegfink>
mrvn: where is that caml_named_value?
<mrvn>
olegfink: /usr/include/caml/*
<mrvn>
caml/callback.h I would guess
<olegfink>
aha, sounds like a good job for dlopen_c.c
<mrvn>
Does Callback.register make the GC slower too?
<mrvn>
olegfink: for you the problem is to have libraries provide callback+data. If you can't pass along the extra data then you need specific Ccode for every single callback.
<olegfink>
caml_register_global_root(&nv->val);
<olegfink>
that's what caml_register_named_value calls
<olegfink>
(byterun/callback.c)
<mrvn>
olegfink: thought so
<mrvn>
No source here. :)
<olegfink>
lucky you.
* olegfink
has about five incarnations of byterun code there, under three different version control systems and all in different state of brokenness
angerman has quit []
angerman has joined #ocaml
angerman has quit [Client Quit]
seafood has quit []
_zack has joined #ocaml
OChameau has joined #ocaml
s4tan has joined #ocaml
bla has quit [Read error: 110 (Connection timed out)]
dima2001 has quit [Read error: 110 (Connection timed out)]
_zack has quit ["Leaving."]
_zack has joined #ocaml
tripwyre has quit []
dima2001 has joined #ocaml
_zack has quit ["Leaving."]
tripwyre has joined #ocaml
sgnb`` has joined #ocaml
sgnb` has quit [Read error: 104 (Connection reset by peer)]
hkBst has joined #ocaml
rwmjones_ has joined #ocaml
Snark has joined #ocaml
rwmjones has quit [Read error: 113 (No route to host)]
rwmjones_ has quit ["Closed connection"]
rwmjones has joined #ocaml
flx_ is now known as flux
theIdeaMen has joined #ocaml
dima2001 has quit [Remote closed the connection]
arquebus has joined #ocaml
Ched has joined #ocaml
itewsh has joined #ocaml
tripwyre has quit []
_zack has joined #ocaml
kaustuv has left #ocaml []
arquebus has left #ocaml []
sgnb`` is now known as sgnb
Camarade_Tux has quit ["Quitte"]
itewsh has quit [Read error: 110 (Connection timed out)]
Alpounet has quit [Read error: 104 (Connection reset by peer)]
r0bby has quit [Read error: 60 (Operation timed out)]
r0bby_ has joined #ocaml
Yoric[DT] has joined #ocaml
* rwmjones
got a review copy of the new ocaml book
_zack has quit ["Leaving."]
Yoric[DT] has quit ["Ex-Chat"]
sporkmonger has quit []
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
hkBst has quit [Remote closed the connection]
bacam has joined #ocaml
<theIdeaMen>
how is it?
<flux>
indeed, do share
itewsh has quit [Remote closed the connection]
<theIdeaMen>
anyone know if there is a version of the camlp5 (old camlp4) manual that uses original syntax instead of revised
<mrvn>
flux: Well. It is about book sized and finger thick. And if you open it there is some dead tree stuff in there that is smudged all over with some black dirt in squiggly lines.
thelema has joined #ocaml
sporkmonger has joined #ocaml
Alpounet has joined #ocaml
alexyk has joined #ocaml
<rwmjones>
I've just leafed through it, and it passes the "smell test" very well ... ie. properly formatted, readable
<rwmjones>
I'm going to read the first few chapters properly on the train tongith
<rwmjones>
tonight
<Alpounet>
of ?
thelema has quit [Read error: 60 (Operation timed out)]
<Alpounet>
I may consider buying it to see what it is worth.
mlh has quit [Remote closed the connection]
mlh has joined #ocaml
r0bby_ has quit [Remote closed the connection]
r0bby has joined #ocaml
itewsh has joined #ocaml
^authentic has joined #ocaml
Melanoma1ky has joined #ocaml
MelanomaSky has quit [Remote closed the connection]
authentic has quit [Read error: 110 (Connection timed out)]
^authentic is now known as authentic
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
angerman has joined #ocaml
_zack has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
bla has joined #ocaml
|jedai| has quit [Read error: 60 (Operation timed out)]
angerman has quit []
vuln has joined #ocaml
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
itewsh has quit [Operation timed out]
itewsh has joined #ocaml
willb has quit [Read error: 110 (Connection timed out)]
vuln has quit ["leaving"]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
theIdeaMen has quit []
<munga>
I've a small question regarding ocamlgraph. is there a function that give a vertex V and a graph G will return a subgraph G' of G containing the connected components of V in G ?
<totom>
and use remove_vertex on the original graph ? (I'm afraid your need is too specific)
<munga>
totom: these are the strongly connected components...
<totom>
oh sorry
willb has joined #ocaml
<munga>
I mean it's clear how to write such function, I'm wondering if I can do it with the building blocks in ocamlgraph
<kaustuv>
munga: Oper.Neighbourhood?
slash_ has joined #ocaml
Yoric[DT] has joined #ocaml
<munga>
this gives you the list of successor of a vertex ... The neighbourhood of a vertex v is { v' | (succ g v) and (v <> v') }
<munga>
kaustuv: am I wrong ?
<Yoric[DT]>
hi again
alexyk has joined #ocaml
alexyk has quit [Client Quit]
<kaustuv>
munga: I think the transitive closure of the list of neighbours is the set of vertices you want, if I understand you correctly. Then you need to filter out vertices not in this set. Is there a filter-on-vertices function (I can't find it)?
<kaustuv>
Or perhaps Traverse.Dfs.iter_component to get the set of reachable vertices.
* kaustuv
got nothin'
mrvn_ has joined #ocaml
mrvn has quit [Read error: 104 (Connection reset by peer)]
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
alexyk has joined #ocaml
<Alpounet>
Hi
alexyk has quit []
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
alexyk has joined #ocaml
s4tan has quit []
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
bla has quit [Read error: 60 (Operation timed out)]
bla has joined #ocaml
Alpounet has quit ["Quitte"]
Alpounet has joined #ocaml
<_zack>
rwmjones: in fedora, are you building ocamlnet against 3.11 + camlp4 or camlp5?
<_zack>
I was trying to switch back to camlp4 in debian, but it seems there are still issues
<mrvn_>
Does the Unix module officially export any C functions?
mrvn_ is now known as mrvn
_zack has quit ["Leaving."]
* mrvn
needs Unix.file_descr -> int and Unix.error -> int in his C bindings.
<flux>
mrvn, hm, Unix.file_descr _is_ an int?
<flux>
I suppose Unix.error isn't, though
<mrvn>
flux: garantied?
<flux>
well, until they change it :-)
<flux>
I've used this with great success: let int_of_fd (i : Unix.file_descr) = (Obj.magic i : int)
<flux>
for debugging purposes
<mrvn>
flux: Int_val will do
<mrvn>
But Unix.error is a big enum type and the constructors do not match 1:1 with the errno numbers. Not at all.
<flux>
there might not even be reverse mapping?
<mrvn>
should be bidirectional.
<flux>
well, the source knows which one it is :)
<mrvn>
Unix has EUNKNOWNERR of int for anything it doesn't know.
<flux>
I've used a similar approach, but I'm not sure that's a great way to do it..
<flux>
but it still doesn't mean the reverse mapping exists, only that it is possible to do
<mrvn>
The source only goes from errno to Unix.error as far as I have seen and I haven't seen any documenation of that function that would let me to believe it is a defined API.
<flux>
what do you need it for, btw?
<mrvn>
flux: returning errors in fuse.
<mrvn>
EACESS, EBUSY, EEXIST, EIO, ENOENT, ...
<mrvn>
The only safe thing to do seem to define my own error type and write my own mapping.
<mrvn>
s/seem to/seems to be to/
itewsh has quit [Read error: 110 (Connection timed out)]
itewsh has joined #ocaml
<mrvn>
Somehow I feel that it should be possible to use the C header files to generate a mapping for errno. Maybe some camlp4 code that will parse an enum { ... } and generate a ocaml type for it.
OChameau has quit ["Leaving"]
Amorphous has quit [Read error: 113 (No route to host)]
Amorphous has joined #ocaml
<flux>
I think it might be a more portable approach to parse the current mapping to implement its reverse?
Cheshire has joined #ocaml
itewsh has quit [Connection timed out]
itewsh has joined #ocaml
<mrvn>
flux: convert "type error = Foo | Bar | Baz" into "int map[] = { Foo, Bar, Baz};" you mean?
ronwalf has joined #ocaml
<mrvn>
The unix module should really provide conversion both ways and export an API/ABI for it.
<Yoric[DT]>
Good question: any MacOS X user around here?
<ski__>
Yoric[DT] : afaiu, the `alpha' in `[unpack M_0 as <alpha, x> in M_1]' is for giving a local name for the type hidden in the existential package .. this would mostly be useful if you wanted to give some local type signatures or ascriptions inside `M_1' mentioning the hidden type, though in System F, you'd also explicitly pass types (possibly mentioning `alpha') to "polymorphic" functions
<ski__>
Yoric[DT] : oh, right .. it would probably also be useful in any `pack' operations inside `M_1', where you almost surely want to be explicit about what parts of the type to hide and what parts to not hide
alexyk has quit []
<ski__>
(and the type to hide there often would depend on the previous unpacked hidden type)
<ronwalf>
Yoric[DT]: I use 10.5
Snark has quit ["Ex-Chat"]
<mattam>
Yoric[DT]: yes. 10.5 as well.
<mattam>
ronwalf: why don't you try the 8.2 dmg on Coq's website?
itewsh has quit [Read error: 60 (Operation timed out)]
itewsh has joined #ocaml
<Yoric[DT]>
ski__: I'll try and read your comment later, at the moment, I'm just too tired to understand it.
<Yoric[DT]>
(thanks)
<Yoric[DT]>
ronwalf: mattam: what editor do you use for OCaml?
<mattam>
Carbon emacs
<ronwalf>
Yoric[DT]: Aquamacs
<ronwalf>
(with Tuareg)
<Yoric[DT]>
ok
<Yoric[DT]>
Thanks.
<mattam>
Of course with tuareg
* Yoric[DT]
is writing his OCaml [+Batteries] tutorial.
<Yoric[DT]>
Anyone using vi for OCaml (under any OS)?
<chupish>
elvis & nvi
<chupish>
but I'm mostly :syn off anyway
<chupish>
:
<chupish>
d'oh
<Yoric[DT]>
?
<chupish>
: syn off
<chupish>
I don't use syntax highlighting at all
<Yoric[DT]>
ok
<ski__>
(np)
<chupish>
%
astronut has left #ocaml []
bartiosze has joined #ocaml
<bartiosze>
Hi, can I ask camllight related questions here also?
jeddhaberstro has joined #ocaml
<sanguinev>
I use vi/vim with syntax highlighting on on Ubuntu varieties...
<chupish>
ah, I'm on Solaris & Mac OS X fwiw
<Yoric[DT]>
bartiosze: you can try
<Yoric[DT]>
chupish: ok, thanks
<Yoric[DT]>
sanguinev: what did you need to install?
<bartiosze>
I'm having compilation problems with libunix and other contrib modules. some error are throwed from included string.h and such. Maybe someone can direct me to some linux compilation insructions that could help. I have this 'The Functional Approach to Programming' book I really would try.
<bartiosze>
btw. any positive opinions about it?
<chupish>
wouldn't O'Caml proper work fine for that book?
<chupish>
I mean, unless there is implementational details, you should be fine using O'Caml proper...
<bartiosze>
there were some examples in the very thirst chapters that didn't work for me under OCaml on windows
<bartiosze>
so I thought I'd try it on linux with camllight version
<chupish>
ah
<chupish>
hmm
<bartiosze>
I'm able to compile camllight system (even with bootstraping) but I'd like to try also those contrib modules (like graphing)
<sanguinev>
Yoric[DT]: All that i know of: apt-get install vim
<chupish>
which examples didn't work bartiosze?
itewsh has quit [Connection timed out]
<sanguinev>
Yoric[DT]: Other possible packages might be "ocaml" or "build-essential", but that is all I know of installing and the highlighting works fine.
itewsh has joined #ocaml
<bartiosze>
so the first not-working example was: "a*a + b*b where a=2 and b=2;;"
<chupish>
I don't see "where" as an expression in the Caml light manual either
<chupish>
I mean, let a = 2 and b = 2 in a * a + b * b;; works fine in O'Caml, I'd have to compile Caml Light to check
<bartiosze>
oh please, don't bother.
<bartiosze>
so ok, now, only come-caml mode for emacs and I'm happy and ready :D
<bartiosze>
some caml-mode, I mean
Cheshire has quit ["This computer has gone to sleep"]
<Yoric[DT]>
sanguinev: ok, thanks.
sporkmonger has quit []
itewsh has quit [Read error: 60 (Operation timed out)]