Quantcast
Channel: How to bind var's name and value in the clojure macro? - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by kbsant for How to bind var's name and value in the clojure macro?

You can first capture the variable names and their values into a map:(defmacro name-map [& xs] (let [args-list# (cons 'list (map (juxt (comp keyword str) identity) xs))] `(into {} ~args-list#)))If...

View Article



Answer by Taylor Wood for How to bind var's name and value in the clojure macro?

It looks like you want to write a file of delimited values using binding names and their values from inside a let. Macros transform code during compilation and so they cannot know the run-time values...

View Article

Answer by Svante for How to bind var's name and value in the clojure macro?

I think you are looking for the function name. To demonstrate:user=> (defmacro write-columns [& columns] (let [names (map name columns)] `(str ~@names)))#'user/write-columnsuser=>...

View Article

How to bind var's name and value in the clojure macro?

Assum I hava some(more than 20) variables, I want to save them to a file. I don't want to repeat 20 times the same code.I wrote a macro but it gave me an error.my test...

View Article
Browsing all 4 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>