A Clarification

December 18th, 2007

Nikodemus Siivola writes:

> Huh? #’ gets in the way and #L does not?

No, they both get in the way. Thanks for pointing out my omission.

> How is the CURRY klunky?

I wasn’t clear. When compared to Haskell, where you can write

fun 3

then

(curry #'fun 3)

is more klunky. Especially when currying and composing multiple times, as in this function which computes the sum of squares of a list of numbers:

(compose (curry #'reduce #'+) (curry #'mapcar #'square))

I would just much rather see something shorter. In Haskell (using the same function names):

(reduce +) . (mapcar square)

This was a failed attempt at clarity and brevity:

#M(#R(reduce #'+) #R(mapcar #'square))

I wish the syntax were better, still.

>Finally, I really don’t understand why to use a reader-macro for this when regular macros work for similar purposes more then fine.

Now that you mention it, reader macros do seem a bit overkill.

>Use macros when fuctions won’t do, and use reader-macros when macro’s won’t do is a good rule of the thumb in my books.

Yes, very good, it seems.

>(defmacro <- (&body body) `(lambda (_) ,@body))

> …with the added benefit that the user can macroexpand the form for instant comprehansion.

Yes, that’s good. I hadn’t thought of that. Thanks for the idea.

> I just so do not get this.

Sorry for the confusion.

Popularity: 3% [?]


Trackback URI | Comments RSS

Leave a Reply

Name (required)

Email (required)

Website

Speak your mind