[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | brogoff@s... |
| Subject: | RE: [Caml-list] @, List.append, and tail recursion |
Thanks for the reference. I get nailed by this a couple of times a year, and I usually just blame myself for being sloppy and recode all of my maps, appends, and filters to remove it. I think it would be great if those three functions (at least) could be tail recursive, either by having the compiler do it or by providing these "hole abstractions" in the language. I wonder, like the other Brian, if there are existing ML compilers which implement this optimization, and if there is any chance we'll see this in OCaml? On Fri, 24 Jan 2003, Andrew Kennedy wrote: > Brian, > > The optimization you describe is sometimes known as > "tail modulo cons", and is an example of "destination-passing > style". In other words, the place to put the result (in > this case, the address of the tail of a just-constructed > cons cell) is passed on in a tail-recursive call. > > See "A Functional Representation of Data Structures with a Hole" > by Minamide in POPL'98. > > http://www.score.is.tsukuba.ac.jp/~minamide/index.html > > Although Minimide formalizes the problem in the context of > a typed intermediate language, it's probably quite easy to > spot special cases quite far down the compiler pipeline. > - Andrew. > > > -----Original Message----- [...snip...] ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners