[plt-scheme] Making a fast list like sequence

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Apr 7 18:48:11 EDT 2009

At Tue, 07 Apr 2009 18:32:33 -0400, David Van Horn wrote:
> I see dramatic differences in running times between the built-in list 
> sequence and a naive implementation of list sequencing.  What can I do 
> to make this naive implementation run faster?

If you use use `car', `cdr', and `pair? instead of `first', `rest', and
`(compose not empty?)', you should get the same performance as for
lists.

I note that using `in-list' in the right-hand side of `for' is much
faster than using a list directly. To get that kind of performance, you
define a new form with `define-sequence-syntax'.



Posted on the users mailing list.