ayrnieu changed the topic of #ocaml to: OCaml 3.08.4 available! Archive of Caml Weekly News: http://sardes.inrialpes.fr/~aschmitt/cwn/ | A free book: http://cristal.inria.fr/~remy/cours/appsem/ | Mailing List: http://caml.inria.fr/bin/wilma/caml-list/ | Cookbook: http://pleac.sourceforge.net/
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
UziMonkey has quit [":q"]
<sethk> in general it does
pango_ has quit [Read error: 60 (Operation timed out)]
y6cmE has joined #ocaml
threeve has joined #ocaml
pango has joined #ocaml
<aegray> can someone look at this and maybe give me insight into what i'm doing wrong? http://pastebin.com/378414
y6cmE has quit [Read error: 110 (Connection timed out)]
<beschmi> the code seems to be ok and it compiles here
<aegray> the mapLabTree is supposed to apply a function to all nodes of a tree designated by LTreeNode( 'a, [ (* list of nodes *)])
<aegray> but if i try to apply it with any function, it fails
<aegray> i'm trying to implement it with something like:
<aegray> foldLabTree (fun x y -> ((x, "a"), y)) [] (somefunction) ltree;;
<aegray> so every nodes label gets changed from x to (x, "a")
<aegray> but what would somefunction need to be to accomplish that?
<aegray> ah nm got it
<beschmi> you want: mapLTree : ('a -> 'b) -> 'a labeled_tree -> 'b labeled_tree
<aegray> thnx
<beschmi> np, seems like you've been faster ;)
threeve has quit []
ski has quit [Read error: 110 (Connection timed out)]
_fab has joined #ocaml
ski has joined #ocaml
Skal has joined #ocaml
maayhme has quit ["Leaving"]
ski_ has joined #ocaml
ski has quit [Nick collision from services.]
ski_ is now known as ski
pango has quit [Remote closed the connection]
pango has joined #ocaml
ppsmimou has joined #ocaml
vezenchio has joined #ocaml
Revision17 has joined #ocaml
revision17_ has quit [Read error: 110 (Connection timed out)]
Submarine has joined #ocaml
ski has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
_fab has quit [Remote closed the connection]
Submarine has quit ["Leaving"]
menace has joined #ocaml
ski has quit [Read error: 104 (Connection reset by peer)]
ChipsterOne has joined #ocaml
mauke has joined #ocaml
__DL__ has joined #ocaml
threeve has joined #ocaml
Snark has joined #ocaml
mauke has quit [Read error: 104 (Connection reset by peer)]
mauke has joined #ocaml
mikeX has joined #ocaml
shirogane has joined #ocaml
ChipsterOne has quit []
Submarine has joined #ocaml
mikeX has quit ["Leaving"]
shirogane has quit [Read error: 104 (Connection reset by peer)]
Snark has quit ["Leaving"]
ppsmimou has quit ["Leaving"]
Schmurtz has joined #ocaml
smimou has joined #ocaml
<dylan> hmm, it would seem a recursive directory crawling function should slurp the contents of each dir, rather than leaving the dir_handle open.
<dylan> At least, if you have more sub directories than the maximum number of open file descriptors...
<pango> on the other hand, some directories may be very large...
<dylan> True.
<dylan> Is it safe to assume tail call elimination doesn't somehow magically work in a try ... with construct?
<pango> it doesn't.
<dylan> Makes sense.
<dylan> Could someone tell me if readdir_all (line 10) on http://pastebin.com/378849 is tail recurisve? I assume it is. :)
<dylan> Or better, a compiler option that tells me the same? :)
<pango> looks fine
<pango> ocamlopt -S and look at asm ;)
<dylan> if only it wasn't x86 asm...
<dylan> hehe, I could make a generic "let's ignore exceptions!" function: let safe f x = try Some (f x) with _ -> None
<pango> or let safe l = try Some (Lazy.force l) with _ -> None
<dylan> hmm. Or a function that returns a tuple of ('a, exn), then use match on the exn.
<pango> # safe (lazy (1 / 0)) ;;
<pango> - : int option = None
<dylan> hmm
<dylan> safe : 'a Lazy.t -> ('a option, exn option) ... but that seems like overkill.
<pango> yup :)
<dylan> But fun
<dylan> Every once and a while I wish I could have a function rewrite patterns, or a function that could return a pattern. Usually I chalk it up to madness and have a cup of tea. :P
<pango> some recommend giving up pure functional style when reading files (or directories)
<dylan> Using Stack might be a good idea.
<pango> let files = ref [] in try while true do files := readdir dir :: !files done with End_of_file -> closedir dir ...
<dylan> I'm actually porting a function I wrote in perl.
<dylan> which is mostly functional.
<pango> another idea would be to use HOF... Dir.map or something like that
<pango> instead of constructing lists
<dylan> a visitor function would work quite well.
<dylan> Dir.iter, like
<pango> right
<dylan> its usage is http://pastebin.com/378885
<dylan> just trying to find the best way to write the find function
<dylan> I could easilly make find be a wrapper around an iter-like function.
exa has joined #ocaml
exa has quit [Remote closed the connection]
pango has quit ["brb"]
mrsolo has joined #ocaml
pango has joined #ocaml
Submarine has quit ["in Soviet Russia, Céline Dion owns you"]
shirogane has joined #ocaml
avlondon1 has joined #ocaml
avlondon2 has joined #ocaml
avlondono has quit [Read error: 101 (Network is unreachable)]
Submarine has joined #ocaml
avlondon1 has quit [Read error: 110 (Connection timed out)]
ski has joined #ocaml
shirogane has quit [Remote closed the connection]
_JusSx_ has joined #ocaml
jlarocco has joined #ocaml
Submarine has quit ["Leaving"]
mauke has quit [Remote closed the connection]
mauke has joined #ocaml
avlondon2 has quit [Read error: 110 (Connection timed out)]
_JusSx__ has joined #ocaml
<Nutssh> I'd combine predicate and action. dylan, I'd use whatever was most clear. A simple interface is more important than a simple implementation.
<dylan> predicate and action are seperate for a reason.
<dylan> action determines if recursion is done on a directory. the predicate determines if the action is even called.
_JusSx_ has quit [Read error: 110 (Connection timed out)]
_JusSx__ has quit ["leaving"]
threeve has quit []
vezenchio has quit ["\o/ zutto sagashiteta konna EMOSHON - PYUA na kimochi nemutte ita no ne \o/"]
vodka-goo has joined #ocaml
<twobitsprite> pango: ew... using exceptions as flow control...
batdog is now known as batdog|gone
Skal has quit [Remote closed the connection]
__DL__ has quit ["Bye Bye"]
Schmurtz has quit [Read error: 104 (Connection reset by peer)]
mikeX has joined #ocaml
smimou has quit [Read error: 110 (Connection timed out)]