Re:Gamedev in Lisp. Part 2: Dungeons and Interfaces
by medo-bear on Friday October 18, 2024 @02:23AM
(#41876808)
You can also express LOOP constructs in terms of DO. However if you were to construct a more exotic iterator that is not so straight forward in LOOP (beware of edge cases), I think it is more reasonable to pick DO. I think also that your example illustrates this.
[ Parent
| on HN ]
Re:Gamedev in Lisp. Part 2: Dungeons and Interfaces
by lispm on Friday October 18, 2024 @02:55AM
(#41876971)
I would miss the in-order collects, actually collect/maximize/... features, destructuring of lists, direct type declarations, ...
I also find DO not easy to read and understand.
The code from above I would actually write in LOOP as
(loop for a from 1 upto 5
and b = 10 then (* b 1.5)
collect (* a b) into c
finally (return (list a b c)))
I find that to be readable.
Re:Gamedev in Lisp. Part 2: Dungeons and Interfaces
by medo-bear on Friday October 18, 2024 @03:44AM
(#41877175)
Of course to each their own. I like LOOP a lot actually when I need to do something familiar, however for something unfamiliar DO is often my choice. It also serves as a caution to tread and think carefully when I return to the code. Sometimes, after a while, I realise how to do the DO construct succintly with LOOP