3 ms·
I agree, and I am aware of it. I was about to get into another example to show something that only macros can do, but the post was getting too long. So please
by mck- 15y ago
I agree, and I am aware of it. I was about to get into another example to show something that only macros can do, but the post was getting too long.
So please hang in there ;) I'm getting there.
Also, there are different levels of audience. Diving straight into complex macro structures might just be ineffective.
Above all, I'm not trying to preach to the converted. You seem to be well aware of the powers of Lisp, so not my intended audience. But thanks for reading and your input anyway ;)
- jwhite 15y agoI agree with spacemanaki. Your article introduces higher order functions, which is a big enough concept to keep those unfamiliar well-entertained without going a step too far and throwing in a not-particularly-useful macro. The last part of the article is an un-illuminating distraction. If I wasn't familiar with CL I would probably be scratching my head and asking why the hell that ugly #' is needed in the first place. More seriously though, your macro is dangerous as a teaching example because it introduces variable capture (on i and ans) and unintentional repeated evaluation (of list), which are big gaping traps for the unwary. Also, try passing #'(lambda (a b) (< a b)) as the pred argument to your macro, and see what happens.