No, I still don't get it. Why wouldn't this work?
(def config1
{:key (fn [] (str "do something horrible complicated here" (:blah state)
(:key other-state) (:something evenmorestate)))})
;; To invoke:
((:key config1))
--
You received this message because you are subscribed to the Google
Group
(defmacro encode [get-key]
(let [body (eval get-key)]
`(~@body)))
It turns out this is actually the macro I'm looking for, but I still don't
want to use eval :(
Honestly, it looks to me that you are concocting something overl
Honestly, it looks to me that you are concocting something overly
complicated. Are you sure that a combination of anonymous functions and
dynamic variables won't suffice? Can you, in broad strokes, describe what
you want to achieve?
On Sat, Mar 30, 2019, 18:31 Nathan Rogers wrote:
> (def dict
>
(def dict
{:key `(str "obj isn't defined in this scope" (:blah ~'obj))})
(defmacro encode [ncode get-key]
Ok, so it turns out I have other issues. Args is (:keys dict) and that
doesn't evaluate
(def dict
{:key `(str "obj isn't defined in this scope" (:blah ~'obj))})
Thanks everyone. That's what I needed.
On Fri, Mar 29, 2019 at 3:25 AM Alexander Yakushev
wrote:
> Looks like you are missing a few unquotes. Is this what you expected?
>
> (def dict
> {:key `(str "obj isn't defined in this scope" (:blah ~'obj))})
>
> (defmacro my-macro [my-obj & args]
> `(
Looks like you are missing a few unquotes. Is this what you expected?
(def dict
{:key `(str "obj isn't defined in this scope" (:blah ~'obj))})
(defmacro my-macro [my-obj & args]
`(let [~'obj ~my-obj]
(print ~(:key dict) ~@args)))
(my-macro {:blah "thingy"} "test string")
;; obj isn't de
How about:
(def dict
{:key `(str "obj isn't defined in this scope" (:blah ~'obj))})
(defmacro my-macro [inobj & args]
`(let [~'obj ~inobj]
(print ~(:key dict) ~@args)))
(macroexpand '(my-macro {:blah "thingy"} "t
(def dict
{:key `(str "obj isn't defined in this scope" (:blah ~'obj))})
(defmacro my-macro [obj & args]