I've got a Clojure file which I'm importing other library functions into with :require and :refer in the ns declaration.
I now want to eval some code in that namespace and have it call those libraries.
But when I call it, I get an "Unable to resolve symbol" for the referred function I'm trying to use.
I'm guessing I have to pass it explicitly in to the eval somehow but can't find any examples.
Second question. I'd ideally like to not use Clojure's ordinary eval at all but to run Babashka SCI. Is there a way to pass libraries from my Clojure environment into this?
Update. Code example.
(ns clj-ts.card-server
[:require
...
[patterning.layouts :refer [framed clock-rotate etc]]
...
)
...
(defn one-pattern
"Evaluate one pattern"
[data]
(let [pattern
(try
(eval (read-string data))
(catch Exception e
(let [sw (new java.io.StringWriter)
pw (new java.io.PrintWriter sw) ]
(.printStackTrace e pw)
(str "Exception :: " (.getMessage e) (-> sw .toString) ))) )
]
...
)
Then when calling one-pattern with the following as the data argument
(let [a-round
(fn [n lc fc]
(clock-rotate
n (std/poly
0 0.5 0.4 n
{:stroke lc
:fill fc
:stroke-weight 3})))
]
(a-round 8 (p-color 140 220 180) (p-color 190 255 200 100) )
)
I get an error
Caused by: java.lang.RuntimeException: Unable to resolve symbol: clock-rotate in this context