Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Recursive lists
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-10-11 (16:24)
From: james woodyatt <jhw@w...>
Subject: Re: [Caml-list] About Obj (was Recursive lists)
On 11 Oct 2004, at 06:38, Christophe Raffalli wrote:
> Jean-Christophe Filliatre wrote [quite sensibly]:
>> [...]
>> This shouldn't be advised, and not even posted on this list.
> And how do you write a tail recursive map doing only one structure 
> traversal (which is important with the penalty for memory access) on 
> immutable list without the Obj module ?

By using a more appropriate data structure, e.g. a lazy list.  It's a 
pay-me-now-or-pay-me-later sort of game you're playing here.

Rather than whack on the immutable list, maybe you should consider 
doing this:

	type 'a mlist = N | C of 'a mcell
	and 'a mcell = { mutable cdr: 'a; mutable car: 'a mlist }

No need to thank me.

j h woodyatt <>
markets are only free to the people who own them.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: