Counting from zero

Alan Kay alan.kay at squeakland.org
Tue May 2 13:09:42 UTC 2006


This would have been one of several such solutions in Smalltalk-72, but it 
didn't need to use macros for syntax extension.

Cheers,

Alan

-------------

At 12:15 AM 5/2/2006, Stéphane Rollandin wrote:
>Duncan Mak wrote:
>>I was in a compiler class and was doing a project in Scheme. Like the style
>>prefered by Smalltalk, I strived to use only higher-order functions, like
>>map, instead of doing explicit iterations (Scheme makes that hard anyhow).
>>However, I ran into trouble when I had to iterate two collections together,
>>but each at a different offset, i..e  matching a[i] to  b[i + 2].
>
>I believe the loop macro is implemented in Scheme; it makes this kind of 
>iterations very easy.
>
>loop for i in list-a
>      for j in (cddr list-b)
>      do (your-thing i j)
>
>and you're done
>
>
>Stef





More information about the Squeak-dev mailing list