sci 2022-09-18

Hi. I have an issue evaling a sci form in malil, thought it might be relevant to ask here as well: https://clojurians.slack.com/archives/CLDK6MFMK/p1663500554062529

if something is unresolved in SCI then you have to add it to the context

not sure how malli lets you do that. I'll have a look

🙏 1

i also tried calling the java fn directly without the wrapping clojure fn. same results ie could not resolve Runtime/..

but what should i pass?

yeah. I don't see how as a malli user you can provide extra options there. Better ask in #malli or to @ikitommi here

🙏 1

wait, unrelated to malli, what is sci missing? the Runtime namespace? the error is still unclear

if you want to expose your get-cpus function in SCI, you can do that as follows:

(def ctx (sci/init {:namespaces {'user {'get-cpus get-cpus}}}))
(sci/eval-string* ctx "(get-cpus)")

it needs an`:import` instead of :require

you don't get access to host classes by default, they have to be explicitly brought in:

{:classes {'Runtime Runtime}}