[plt-scheme] fp source, fp speed (was: something else)

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Jun 12 17:09:10 EDT 2009

On Jun 12, 2009, at 2:05 AM, Captain___nemo wrote:

> Thanks a lot :)
>
> Won't it be inefficient building list for large values (say thousands
> instead of 10)? Isn't there any direct loop syntax in Scheme?


This is a pretty naive view of the world (where naive is a technical  
word, not a human word with other connotations).

   (for-each (curry printf "~s\n") (build-list n values))

might not be pretty for

   for(i = 0; i < n; i++)
     printf("~s\n",i)

but jumping to the conclusion that this expression builds an  
intermediate list of 1,000,000 numbers, just because n = 1,000,000 is  
a pretty fast one. Aggressive compilers have eliminated such lists  
(and arrays) for about two decades now, both as deforesters in the FP  
world and as loop fusers in the Fortran realm.

Having said, mz isn't an aggressive compiler yet. To get there, you  
will have to sign up as a compiler writer PhD student with Matthew

-- Matthias



Posted on the users mailing list.