Counting from zero

Duncan Mak duncanmak at gmail.com
Tue May 2 07:43:54 UTC 2006


On 5/2/06, Stéphane Rollandin <lecteur at zogotounga.net> wrote:

> 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


Yeah, but I had to restrict myself to what's defined in R5RS, which does not
include the loop macro.

So yes, I ended up writing a similar macro, but I find that once I start
using something like this, I quickly end up writing not-so-functional code,
i.e. things that involve using set!.

I find Ralph's suggestion of Streams interesting. Following the discussion
on the other thread on how to start learning Smalltalk, I think I've learned
to use the Number classes and Collection classes pretty well, but the
Streams classes is a family that I'm not so familar with. I think now is a
good point for me to go learn how to use them. Other than the Streams
section in the Blue Book (Smalltalk, The Language), are there other
resources that you guys would recommand?

Thanks,

Duncan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20060502/fd4e5f5a/attachment.htm


More information about the Squeak-dev mailing list