I'm trying to generate functions in clojurescript from an array of function
names that I acquire from a third-party library. The approach I'm taking isn't
working out. Can anyone help adjust my approach?
Here is some sample code for discussion.
In the form below, the "names" parameter in the "gen-fns" macro is a symbol,
which can not be converted to an ISeq. If I "(eval names)", then "Unable to
resolve symbol: tags in this context".
```clojurescript
(ns example.core
(:require-macros [example.core :as macro]))
(def names
["a" "b" "c"])
(macro/gen-fns names)
```
```clojure
(ns example.core)
(defn- gen-fn [n]
`(defn ~(symbol n)
[& args#]
(apply ~(symbol "js" "console.log") ~n args#)))
(defmacro gen-fns [names]
`(do ~@(map gen-fn names)))
```
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.