It doesn't matter how many times you read it through, you always spot a
mistake just *after* you hit send.

>    # easy way of doing the above
>    multiples(n) = [n for n in 1 to 12]

That should be:

      multiples(n) = [n * i for i in 1 to 12]

It was a teaser for list generators which fall out naturally when you accept
that all statements (like for) are actually expressions that yield 0 or more
values.  It's the same thing as:

      multiples(n) = [
         for i in 1 to 12;
            n * i;
         end
      ]

which should Just Work[tm]

BTW I haven't implemented this yet.  I think I've got it figured out, but I've
got a feeling there's some nastiness waiting to surprise me.  So mark it as
tentative for now.

A


_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to