Kenny Tilton wrote:
KMP: The example you cite is quite simplistic.....snip...A
loop like this:
(loop for x from 0
for y in some-list
when (good-result? y)
collect (list x y))
is easy to write and maintain, and much easier to explain than the equivalent, but more Lispy:
(do ((x 0 (+ x 1))
(y-list some-list (cdr y-list))
(result '()))
((null y-list) ;; [fixed]
(nreverse result))
(let ((y (first y-list)))
(when (good-result? y)
(push (list x y) result))))
Ugh. Howse about:
(let ((goody-pos -1)
goodies)
(dolist (it some-list (nreverse goodies))
(incf goody-pos)
(when (good-result? it)
(push (list goody-pos it) goodies))))
perhaps i will be swayed someday by the charms of loop, but i gotta
tell you, i just don't get it. is loop for people who can't read lisp? can't be, lisp is easier to read than loop. stumped.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 418 |
Nodes: | 16 (4 / 12) |
Uptime: | 24:57:48 |
Calls: | 8,773 |
Calls today: | 16 |
Files: | 13,289 |
U/L today: |
2 files (23,312K bytes) |
D/L today: |
3 files (1,633K bytes) |
Messages: | 5,964,994 |