At the REPL, this works perfectly:

 > (defn get-users [] [:susan :kwan])
 > 
 > (defn what-is-this-function [f] ((resolve (symbol f))))
 
 > (what-is-this-function "get-users")
 >[:susan :kwan]
 
In an uberjar this does not work. I read somewhere that the runtime 
name-space is different than the REPL namespace and different from the 
namespace that exists while the compiler compiles the code. 

So how do I resolve the symbol correctly? 

I have functions that call a MySQL database, and each function is named 
after a database table. Most of the mechanics of the call are the same, the 
only thing different is the SQL. So I have functions such as "company" and 
"user" and "product". I also have a function called (select). I call select 
with one of the other functions, given as a string: 

(select "product")

Inside of (select) I need to turn "product" into a resolved symbol that I 
can call. 

Afterwards, I store the results in a map in an atom. I want to use the 
database names as the keys. So "product" should be the key that holds the 
results of the function "product". 

But what I need to do to correctly resolve the string to a function? 





-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to