aboutsummaryrefslogtreecommitdiff
path: root/lux-js
diff options
context:
space:
mode:
Diffstat (limited to 'lux-js')
-rw-r--r--lux-js/source/program.lux22
1 files changed, 12 insertions, 10 deletions
diff --git a/lux-js/source/program.lux b/lux-js/source/program.lux
index 6163c2dfa..295aba2ce 100644
--- a/lux-js/source/program.lux
+++ b/lux-js/source/program.lux
@@ -465,9 +465,10 @@
[?output (javax/script/ScriptEngine::eval (_.code input) interpreter)]
(wrap [])))
- (def: (define! interpreter context input)
- (-> javax/script/ScriptEngine Context _.Expression (Try [Text Any _.Statement]))
- (let [global (reference.artifact context)
+ (def: (define! interpreter context custom input)
+ (-> javax/script/ScriptEngine Context (Maybe Text) _.Expression (Try [Text Any _.Statement]))
+ (let [global (maybe.default (reference.artifact context)
+ custom)
@global (_.var global)]
(do try.monad
[#let [definition (_.define @global input)]
@@ -488,10 +489,10 @@
(def: (ingest context content)
(|> content (\ utf8.codec decode) try.assume (:as _.Statement)))
- (def: (re_learn context content)
+ (def: (re_learn context custom content)
(..execute! interpreter content))
- (def: (re_load context content)
+ (def: (re_load context custom content)
(do try.monad
[_ (..execute! interpreter content)]
(..evaluate! interpreter context (_.var (reference.artifact context))))))))))
@@ -525,9 +526,10 @@
[?output (..eval (_.code input))]
(wrap [])))
- (def: (define! context input)
- (-> Context _.Expression (Try [Text Any _.Statement]))
- (let [global (reference.artifact context)
+ (def: (define! context custom input)
+ (-> Context (Maybe Text) _.Expression (Try [Text Any _.Statement]))
+ (let [global (maybe.default (reference.artifact context)
+ custom)
@global (_.var global)]
(do try.monad
[#let [definition (_.define @global input)]
@@ -546,10 +548,10 @@
(def: (ingest context content)
(|> content (\ utf8.codec decode) try.assume (:as _.Statement)))
- (def: (re_learn context content)
+ (def: (re_learn context custom content)
(..execute! content))
- (def: (re_load context content)
+ (def: (re_load context custom content)
(do try.monad
[_ (..execute! content)]
(..evaluate! context (_.var (reference.artifact context)))))))))