[iterate-devel] Bad superiority example
Eivind Midtgård
eivind at autosim.no
Sun Apr 11 13:32:18 UTC 2010
The document at http://common-lisp.net/project/iterate/ uses this as an example of the superiority of iterate over loop:
Finding the longest list in a list of lists:
(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))
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.
Eivind
More information about the iterate-devel
mailing list