sci

maybenot 2025-12-21T07:32:09.765239Z

Let's say I want to run SCI script multiple times, and in the context of the script user may define some vars, what is the proper way to preserve those vars between invocations?

borkdude 2025-12-21T07:47:43.055169Z

Make a context

borkdude 2025-12-21T07:51:36.489439Z

(def ctx (sci/init {}))
(sci/eval-string* ctx "(def x 1)")
(sci/eval-string* ctx "x") ;;=> 1

🔥 1
1
maybenot 2025-12-21T08:04:11.912289Z

Thank you! Also, what's the best way to introspect a usage of the namespaces? For example I want to analyze SCI script and detect how often a var from some provided namespace is used? Probably some standard Clojure tooling like reader?

borkdude 2025-12-21T08:08:16.986989Z

maybe clj-kondo? https://github.com/clj-kondo/clj-kondo/tree/master/analysis

💡 1
1