The symbol itself does not hold your function, the Var it names does.
This says "take the contents (@ = deref) of the Var (resolve) named by the symbol (symbol) whose name is "squared" and apply it (as a function) to the argument 2:
(@(resolve (symbol "squared")) 2)
This says "take the Var named by the symbol etc.":
((resolve (symbol "squared")) 2)
Both will work, since Vars, when asked to act as a function, defer to the functions stored in them. (If you try to use a Var as a function when it is not bound to a function, an error will result.)
This says "take the symbol named "squared" and apply it as a function to the argument 2" -- note that the symbol itself is used as the function:
((symbol "squared") 2)
Now symbols can be used as functions (they implement the clojure.lang.IFn interface), but the way they act when used in this way is that they look themselves up in their argument, i.e. treat their argument as a map and perform a lookup inside it:
('foo {'foo 2})
; is equivalent to
(get {'foo 2} 'foo)
If the argument passed to a symbol is not something it makes sense to do lookups in, nil is returned.
(a :b c & d)where both a and c are macros. I was hoping if I switch that to(a :b :c & d)and then convert :c to a symbol it will work. I have a feeling this is completely wrong actually, but since my little idea of((symbol "squared") 2)didn't work I figured I'd ask how that works....(a :b c & d)form, then most likelyaproduces an expansion which includescverbatim in non-operator position. If you only want to include the name of thecmacro in the expansion (and the actual thing you pass toais the symbolic name of the macroc), then you could just add a quote to the expansion, so that you return'crather thancin the appropriate place. If you actually want to call thecmacro, you need to make sure that it ends up being inserted in the operator position in the expansion produced bya.(defmacro [x] ...)where I know that x is a form like(f a b c)and I want to transform it to(fn [n] (f n a b c)). But I'm not sure if this is possible or how to even begin to go about it if it is. I feel like I should open a new question if you want to take a stab at it.(defmacro transform [[f & args]] (fn [n#] (~f n# ~@args)))should work.