[Haskell] Re: [Haskell-cafe] Haskell versus Lisp
immanuell at enfocus.be
Wed Sep 21 07:12:16 EDT 2005
"Tomasz Zielonka" <tomasz.zielonka at gmail.com> writes:
> On Wed, Sep 21, 2005 at 08:53:47AM +0100, Immanuel Litzroth wrote:
>> "David F. Place" <d at vidplace.com> writes:
>> >I was hoping that the examples I requested would be examples of
>> >particular control constructs or extensions to the language's syntax
>> >and semantics. Though I admit that such things are possible in lisp,
>> >I suspect that their utility is minimal.
>> Ever heard of the loop macro?
>> Immanuel Litzroth
> I would be nice if you could give some examples for use of LOOP macro
> that you think would be cumbersome to translate to Haskell.
That was not the original question and I think that would lead to
pointless discussion about the meaning of "cumbersome".
Loop is an example of a control construct that can be implemented by a macro.
One can can discuss it's utility, but it was deemed important enough to be
standardized (by lisp people). It was only one of the macros developed
at that time to do things sequencelike things (series, generators/gatherers were
Another example is UFFI, basically a bunch of macros to do platform
independent foreign function interfaces.
I a currently writing a macro to generate the functions and
datastructures to read an ipod database. This allows me to
(defheader (header-name inherits-from)
(field-name length &optional reader)...).
I doubt this would be easy in Haskell (maybe with TH it could be done)
since I build a list of (header-name . (field-names ...)) at compile
time which is then used to generate code that locally binds these
to the result of reading them so that readers can refer to fields
already read e.g.
(let* ((field-name (reader stream)))
((field-name2 (reader field-name1 stream))
More information about the Haskell-Cafe