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

Andre wrote:
> A macro can be used to hide this detail, and can be justified by the
> same arguments used for any other kind of abstraction.
>
> These include:
>
> - Modularity: being able to change the implementation
> from e.g., thunks to monads without having to change all the use sites.
> - Optimization: The macro might construct thunks behind the
> scenes, but does not have to. A syntax that is agnostic with
> respect to this detail is arguably better than a HOF that isn't,
> for a looping construct where performance might be important.


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

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