>>36I've been reading On Lisp recently
good for you.
Though the abbreviation can’t be passed to apply or funcall.
What? What's the code?
* (defun a (&rest vars) (apply #'+ vars))
A
* (a 1 2 3)
6
* (funcall #'a 1 2 3)
6
whereas if we had tried to define an abbreviationfor quote using a normal macro,
(defmacro q (obj)
‘(quote ,obj))
it would work in isolation,
(eq ’a (q a))
T
but not when nested.
Actually it does work when nested as far as eval in concerned.
* (defmacro q (f) `(quote ,f))
Q
* (q 2)
2
* (q (q 2))
(Q 2)
* (eval (q (q 2)))
2
The book saying it doesn't work because
(q (q 2))
evaluates to
(q 2)
rather than
(quote 2)
. These expression will both evaluate to 2, but as they are,
equal
thinks they are different. If that's actually a problem, you could try to write
q
so that it inspects the form inside and replaces all nested
q
's with
quote
's, but it would be difficult since not every
q
in the car position will neccessarily be a call to
q
. Not every sexp will be evaluated, or evaluated in vanilla lisp. Replacing every q inside in the car position with quote might not always be what you want.
So you can bullshit all you want, but that doesn't change the fact that Lisp is a very bad metaprogramming language and very hard to use correctly. There are all sorts of corner cases that the shitty unannotated text s-exps cannot handle.
I didn't get the first problem. The second example I found silly. The quotes do get weird, though. They get really weird when you nest quasiquotes. But still, I'd rather have the quotes than not have them.
>>44Thus, writing a correct codewalker in Scheme is no easier than in CL (which is very hard).
Nope, it's easier in scheme than lisp. It's harder in lisp because of all the macros in the standard library. You need to be able to walk them all and they all introduce their own context to the walk.
There was a similar sentiment expressed in Let Over Lambda, too. You see, even experienced Lispers admit the weaknesses of Lisp metaprogramming, and only you - an obvious newbie to Lisp - are trying to deny it.
I believe lisp could do what it does better, but I have yet to find another language that can do what lisp does as well. But you don't need a language to do what lisp does. You can write code that writes code for you. It's just time consuming to design a language and compile it to another. And once it's created, adjusting that language takes effort. In lisp, it's easier.