Even non-programmers know
what it means to say "For every setting at the table, make sure the napkin is arranged right".
This can be expressed functionally in Scheme using map (like mapcar in CL). It's not necessary to use iteration.
But MAP is not good for expressing "For every number from 0 to 9, make sure it appears on the phone dial" because Scheme does not provide an object
over which one can "map" numeric ranges, as CL's LOOP does.
I guess my point is that some things "feel" recursive and should be expressed recursively. But some things "feel" iterative, and I don't see anything wrong
with:
(loop for entry in some-list
for name = (person-name entry)
for age = (person-age entry)
collect (list name age))
Kent M. Pitman wrote:
I guess my point is that some things "feel" recursive and should be expressed
recursively. But some things "feel" iterative, and I don't see anything wrong
with:
(loop for entry in some-list
for name = (person-name entry)
for age = (person-age entry)
collect (list name age))
Abysmal.
(map
(lambda (entry) (list (person-name entry) (person-age entry)))
some-list)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 475 |
Nodes: | 16 (2 / 14) |
Uptime: | 23:10:46 |
Calls: | 9,488 |
Calls today: | 7 |
Files: | 13,617 |
Messages: | 6,121,104 |