JanetDocsPlaygroundI'm feeling luckyGitHub sign in
(defn eval-string ``Evaluates a string in the current environment. If more control over the environment is needed, use `run-context`.`` [str] (var state (string str)) (defn chunks [buf _] (def ret state) (set state nil) (when ret (buffer/push-string buf str) (buffer/push-string buf "\n"))) (var returnval nil) (run-context {:chunks chunks :on-compile-error (fn compile-error [msg errf &] (error (string "compile error: " msg))) :on-parse-error (fn parse-error [p x] (error (string "parse error: " (:error p)))) :fiber-flags :i :on-status (fn on-status [f val] (if-not (= (fiber/status f) :dead) (error val)) (set returnval val)) :source :eval-string}) returnval)