Search found 5 matches
- Mon Sep 07, 2015 2:36 pm
- Forum: Common Lisp
- Topic: Trying to rewrite an ugly macro
- Replies: 10
- Views: 25877
Re: Trying to rewrite an ugly macro
In general, they reduce typing, in this particular situation I wouldn't be using them :) SYMBOL-MACROLET exists primarily for things like WITH-SLOTS, and WITH-ACCESSORS, it allows you lexically to use a symbol to substitute for an expression. So it's a bit like a macro that doesn't need to be the f...
- Sun Sep 06, 2015 1:46 pm
- Forum: Common Lisp
- Topic: Trying to rewrite an ugly macro
- Replies: 10
- Views: 25877
Re: Trying to rewrite an ugly macro
Forgive my ignorance, but why is a symbol macro necessary in the first place? Isn't it unnecessarily polluting the namespace? What's so great about a symbol macro?David Mullen wrote:Sod Almighty wrote:Well, I guess I had gensyms on the brain, is why. You're right, of course, a normal let binding will also shadow a symbol macro.
- Fri Sep 04, 2015 5:30 pm
- Forum: Common Lisp
- Topic: Trying to rewrite an ugly macro
- Replies: 10
- Views: 25877
Re: Trying to rewrite an ugly macro
Does symbol-macrolet declare a dynamic binding for the ,body call, that shadows the original macro? No, the shadowing is lexical. Ah, of course it is! (See, this is how new I am to lisp! I totally forgot it was expanded at compile-time.) In which case, my question would be "why not just use a ...
- Thu Sep 03, 2015 5:44 pm
- Forum: Common Lisp
- Topic: Trying to rewrite an ugly macro
- Replies: 10
- Views: 25877
Re: Trying to rewrite an ugly macro
part of your problem is that you seem to have misunderstood the theory behind gensyms. The point is to create anonymous symbols to be used in the expansion, so that their bindings won't conflict with any variables introduced by the user of the macro. If you have WITH-GENSYMS inside the backquoted e...
- Tue Sep 01, 2015 3:41 pm
- Forum: Common Lisp
- Topic: Trying to rewrite an ugly macro
- Replies: 10
- Views: 25877
Trying to rewrite an ugly macro
I'm new to lisp, and have been trying to learn Common Lisp by diving in and writing some code. I've read plenty of documentation on the subject, but it's taking a while to really sink in. I have written a couple of macros ( ? and ?? ) for performing unit tests, but I'm having some difficulty. The co...