[iterate-devel] Bad superiority example
Andreas Fuchs
asf at boinkor.net
Sun Apr 11 16:57:17 UTC 2010
2010/4/11 Eivind Midtgård <eivind at autosim.no>:
> (iterate (for elt in list-of-lists)
> (finding elt maximizing (length elt)))
>
> whereas the example of how it can be done in loop is long and contorted. But loop can do
>
> (loop for elt in list-of-lists
> maximizing (length elt))
Your loop example returns the length of the longest sublist. The
Iterate example yields the longest sublist itself. I am afraid the
loop equivalent really has to be this contorted.
> The example in 3.2 Named blocks may be better as a selling point:
>
> (iter outer (for i below (array-dimension ar 0))
> (iter (for j below (array-dimension ar 1))
> (in outer (collect (aref ar i j)))))
>
> showing that the outer loop can easily collect data produced in the inner loop.
This one is good. I've replaced the (IMO, not very strong) generators
example with it.
Cheers,
--
Andreas Fuchs, (http://|im:asf@|mailto:asf@)boinkor.net, antifuchs
More information about the iterate-devel
mailing list