eval - clojure resolving function from string name -
In Closer 1.2 RC1, I want to get the function based on string name and evaluate it.
Function definition
(ns my-ns) (defar mycar [x] (first x))
: (<-> <->
((ns-resolution * ns * (symbol "maakar")) '(3 4)) ((trainee * ns * (symbol "mikekar"))' (3 4) ) ((Ackell (symbol "MAKER")) '(3 4))
But are they looking ugly any better way? If not, who is the most idiotic?
It worked for me without using eval:
User & gt; (Defar mycar [x] (first x)) # 'User / MICR user & gt; [1 2 3]) 1
This works because the resolver finds the maker var in the current namespace and forces the var function. This is a small version of your first example. I will only use it so that I can not use eval.
Comments
Post a Comment