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"
Ulrich Hobelmann

2005-11-03, 7:01 pm

David Van Horn wrote:
> Ulrich Hobelmann wrote:
>
> This example is exactly where a macro gives you nothing compared to its
> procedural counterpart. Well, except that I have to remember another


Efficiency. To make the Scheme version avoid a dynamic function call
FOR-EACH needs to be recognized by the compiler. DOLIST is just a macro
that expands to label-and-goto code.

> 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.


That's right, but DOLIST's syntax is so easy that I gladly pay the
price. FOR-EACH is too verbose and distracts from the essentials, IMHO.

> 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?


I find it more readable, more writeable, and it's probably faster.

--
The road to hell is paved with good intentions.
Sponsored Links







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

Copyright 2008 codecomments.com