lisp - clojure - resolve a symbol inside let -


how write function resolve symbol in lexical environment?

(let [foo some-var]   (let [sym 'foo]     (resolve-sym sym))) 

i want var 'foo bound to.

i not sure why want this, looks can done. http://clojuredocs.org/circumspec/circumspec.should/local-bindings

(defmacro local-bindings   "produces map of names of local bindings values.    now, strip out gensymed locals. todo: use 1.2 feature."   []   (let [symbols (remove #(.contains (str %) "_")                         (map key @clojure.lang.compiler/local_env))]     (zipmap (map (fn [sym] `(quote ~sym)) symbols) symbols)))   (let [foo 1 bar 2]   (local-bindings)) => {foo 1, bar 2} 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -