[plt-scheme] How to do something to all element of a list but the last

From: Grant Rettke (grettke at acm.org)
Date: Fri Aug 8 18:59:03 EDT 2008

> I'm not sure, but that definition might require O(n^2) time. (Try
> timing it and seeing ...)

Running it against a 10,000 item list, and doing no work in the
function (calling void), it is:

cpu time: 2422 real time: 2422 gc time: 565

cpu time: 16 real time: 16 gc time: 0

> This is how I'd write it but I'm old fashioned when it comes to little
> loops like these. (And I didn't run the code. here's hoping no typos.)

Thanks.


Posted on the users mailing list.