Can you use a more interesting example? I could just do this if I wanted a oscillating function:
(let (p) #'(lambda () (progn (setf p (null p)) (if p #'+ #'-))))
some of the stack based languages have a similar abstraction of functions being flat arrays of constants. But it isn't parsed so it isn't as easy to use well.
>>14
There isn't that much to them. Just use them a few times and then you will feel the satori building within you, just waiting to abstract and factor enterprise design patterns away into self implemented language features. It doesn't need to be a lisp either, but it should have a comparable macro system.
Wait, what the fuck? Macro setq2 just uses procedure comtran without any issues? But comtran isn't even defined yet! What if someone does something evil/stupid like (let ((comtran evil-procedure)) (setq2 x y z))? What if comtran has an instance of setq2 in it? Is it just me, or macroexpansion-time stuff should live in its own namespace?
>>28
In that case the macro m has lexical scope, and it uses the mf function defined in the let statement for its code transformer. It is powerful to let any user defined lisp function to assist your macro. And we are creeping up on first class macros, but we haven't gotten there yet.
Making them explicit helps with efficiency in the implementation. To maintain performance, they should all be expanded at compile time, and this would be hard if they weren't explicit. Not to mention a macro getting into a place where you only wanted a function would be a hard bug to figure out. But like all things that help performance, it must also cut down on expressive power and possibilities.
>>38 >>37 didn't say that the leakiness isn't justified.
Name:
332012-11-12 4:50
Little did I know that my endeavour would slowly drive me to madness. Seriously, what the fuck. I need some good references on macro magic, and maybe a hug or two.