| David Van Horn 2005-11-03, 7:01 pm |
| Ulrich Hobelmann wrote:
> Good example. I much prefer Lisp's
> (dolist (x '(1 2 3))
> (format t "~d~%" x))
>
> over Scheme's
> (for-each (lambda (x) (display x) (newline))
> '(1 2 3))
>
This example is exactly where a macro gives you nothing compared to its
procedural counterpart. Well, except that I have to remember another
binder besides the universal one, lambda. I have to remember the
evaluation rules for this special form rather than the universal one for
application. There's no abstraction or any other benefit offered by
dolist over for-each. Lastly, dolist has been relegated to second class
status whereas for-each is a first-class citizen.
Maybe there are other features of dolist that separate it from for-each,
but for this example the procedure clearly wins in my opinion.
Could you say *why* you much prefer one over the other?
David
|