<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/01/624b5af3263b83ed919ac074b95954f7"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2003-01-30T01:44:30"
  subject="RE: [Caml-list] @, List.append, and tail recursion"
  prev="2003/01/d02a5fa1397339cee9920edfaaf9696a"
  next="2003/01/82d94403680b52187ef16b17c0a53ee4"
  prev-in-thread="2003/01/66af9c604b2e1cbf5540394e5080e697"
  next-in-thread="2003/01/592b98fe8dedf13711d78616753b71af"
  prev-thread="2003/01/ca206608ecf5956dd3d853c07789a29d"
  next-thread="2003/01/5c86d82d713130bc02c3598ca34b3ae0"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="RE: [Caml-list] @, List.append, and tail recursion">
<msg 
  url="2003/01/66af9c604b2e1cbf5540394e5080e697"
  from="Andrew Kennedy &lt;akenn@m...&gt;"
  author="Andrew Kennedy"
  date="2003-01-24T15:35:08"
  subject="RE: [Caml-list] @, List.append, and tail recursion">
<msg 
  url="2003/01/624b5af3263b83ed919ac074b95954f7"
  from="brogoff@s..."
  author="brogoff@s..."
  date="2003-01-30T01:44:30"
  subject="RE: [Caml-list] @, List.append, and tail recursion">
<msg 
  url="2003/01/592b98fe8dedf13711d78616753b71af"
  from="Christophe Raffalli &lt;Christophe.Raffalli@u...&gt;"
  author="Christophe Raffalli"
  date="2003-01-31T09:34:53"
  subject="Re: [Caml-list] @, List.append, and tail recursion">
<msg 
  url="2003/01/018ac7ba03a5d6d873c847f8d803a969"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-30T15:54:23"
  subject="Re: [Caml-list] @, List.append, and tail recursion">
</msg>
<msg 
  url="2003/01/f37d898ed760057b2a30d07937bc9aae"
  from="Mattias Waldau &lt;mattias.waldau@a...&gt;"
  author="Mattias Waldau"
  date="2003-01-31T10:33:46"
  subject="RE: [Caml-list] @, List.append, and tail recursion">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
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:
&gt; Brian,
&gt; 
&gt; The optimization you describe is sometimes known as
&gt; "tail modulo cons", and is an example of "destination-passing
&gt; style". In other words, the place to put the result (in
&gt; this case, the address of the tail of a just-constructed 
&gt; cons cell) is passed on in a tail-recursive call.
&gt; 
&gt; See "A Functional Representation of Data Structures with a Hole"
&gt; by Minamide in POPL'98.
&gt; 
&gt; http://www.score.is.tsukuba.ac.jp/~minamide/index.html
&gt; 
&gt; Although Minimide formalizes the problem in the context of
&gt; a typed intermediate language, it's probably quite easy to 
&gt; spot special cases quite far down the compiler pipeline.
&gt; - Andrew.
&gt; 
&gt; &gt; -----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

</contents>

</message>

