True! But from what I understand of the way symbol-macrolet works, it's
not possible to do one without the other. symbol-macrolet actually looks
for only symbols in the forms you pass it after the let bindings; it won't
traverse inside any quoted forms. It also takes care not to ov
Hi Hunter,
however, in this way you are expanding the application of the macro
"symbol-macrolet" (which is itself a macro), not just the symbol macro "b":
(pprint (mexpand-1 '(symbol-macrolet [b (+ 1 2)] b ["something" "else"])))
;; (do (+ 1 2) [&quo
This worked for me (after some experimentation):
(pprint (mexpand-1 '(symbol-macrolet [b (+ 1 2)] b)))
;; (do (+ 1 2))
;; nil
Cheers,
H
On Saturday, 5 December 2015 07:45:38 UTC, Ritchie Cai wrote:
>
> I'm not sure how to print a macroexpand on macros that defined in macro
I'm not sure how to print a macroexpand on macros that defined in macrolet
or symbol-macrolet.
with normal macros, I can do:
(defmacro test-macro [] '(+ 1 2))
(pprint (macroexpand-1 '(test-macro)))
;; (+ 1 2)
;; nil
but with macrolet or symbol-macrolet:
(symbol-macrolet
handling differently.
There's one major limitation: macrolet macros are invisible inside
macrolet macros. That is, this won't work:
(let [x 2]
(macrolet [(foo [x] `(list 'quote ~x))
(bar [y] `(println ~x ~(foo y)))]
(bar sym)))
to give this:
2 sym
nil
Code:
Not exactly documentation, but
https://github.com/clojure/clojure/blob/1.2.x/src/jvm/clojure/lang/Compiler.java#L37
On Feb 11, 1:38 pm, Ken Wesson wrote:
> On Fri, Feb 11, 2011 at 3:09 AM, Konrad Hinsen
>
> wrote:
> > At first glance, it seems that there are few more special forms that need
> >
On Fri, Feb 11, 2011 at 3:09 AM, Konrad Hinsen
wrote:
> At first glance, it seems that there are few more special forms that need
> special treatment. I see fn*, let*, loop*, and try, but there is also
> deftype* and reify* that have peculiar requirements
Damn. Those weren't listed on any of the
On 11 Feb 2011, at 03:15, Ken Wesson wrote:
(defmacro macrolet [fnspecs & body]
`(macrolet* #{} ~fnspecs ~@body))
See also clojure.contrib.macro-utils/macrolet:
https://github.com/richhickey/clojure-contrib/blob/master/src/main/clojure/clojure/contrib/macro_utils.clj
It has
On 11 February 2011 02:15, Ken Wesson wrote:
> (defmacro macrolet* [shadowlist fnspecs & body]
> (let [locals (keys &env)
> gensyms (for [_ locals] (gensym))
> qlocals (map quo (for [_ locals] (gensym)))
> ...
This macro is huge!!!
You might w
[(f k) (f v)]) coll))
(if (or (vector? coll) (set? coll))
(into (empty coll) (map f coll))
(map f coll
(declare macrolet-v)
(defmacro macrolet* [shadowlist fnspecs & body]
(let [locals (keys &env)
gensyms (for [_ locals] (gensym))
qlocals (map quo (
On 25.11.2008, at 15:06, Konrad Hinsen wrote:
> I just saw a reference to symbol-macrolet with a description. My
> function replace-syms is indeed very similar, the difference being
> that it takes a map for defining the substitutions to be done,
> instead of a let-like sequence. Th
11 matches
Mail list logo