[plt-scheme] scribblings on PLT Scheme 4.0

From: Paulo J. Matos (pocm at soton.ac.uk)
Date: Mon May 28 06:17:52 EDT 2007

On 5/28/07, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Mon, 28 May 2007 09:44:38 +1000, Andrew Reilly wrote:
> > I'm new to scheme myself, so I probably sholdn't have been
> > making such liberal use of append! in my own code.  I will
> > repent...
>
> Do you used them for performance reasons?
>
> I used `append!' and `reverse!' a lot in my early Scheming, too,
> because they were faster. It bit me often enough (no surprise) that I
> decided to stay away, though there are certainly cases where mutating
> versions work fine.
>

I also use them for performance reasons sometimes. I use them for
example when I want to sort a mapped list. I use (sort! (map f lst)).
Or when I want to append a set of lists that results from map like
(apply append! (map f lst)). I think using ! in these cases is good,
afaik,  because: 1. it's faster, 2. you know the list was just
created, 3. you won't have problems.

Any criticism to this practice?

Cheers,
-- 
Paulo Jorge Matos - pocm at soton.ac.uk
http://www.personal.soton.ac.uk/pocm
PhD Student @ ECS
University of Southampton, UK


Posted on the users mailing list.