[plt-scheme] scribblings on PLT Scheme 4.0

From: Andrew Reilly (andrew-scheme at areilly.bpc-users.org)
Date: Mon May 28 01:12:12 EDT 2007

On Mon, May 28, 2007 at 09:49:41AM +0800, Matthew Flatt 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?

Not really.  In fact, I've been using it mainly for syntactic
convenience despite the fact that I know it's turning the O(N)
operation of adding elements to a list into an O(N^2) one.  My
C, Java and Python experience (where the lists that I use are
growable vectors) has pre-disposed me to think in terms of
"adding elments to the end of a list", and that doesn't seem to
be a native Scheme idiom, so I'll have to get over it.

(set! foo (cons thing foo)) just doesn't do it for me yet.
foo isn't a sufficiently abstract list: I can't pass it as an
argument to a procedure and have that procedure add things to

I can see that I just need to think more functionally: that
procedure should produce a new list, rather than modify an
existing one...  The learning curve extends beyond syntax and



Posted on the users mailing list.