For Programmers: Free Programming Magazines  


Home > Archive > Scheme > November 2005 > Re: HOF implementation of "until"









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: HOF implementation of "until"
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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com