diff options
author | Eduardo Julian | 2023-01-18 01:38:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2023-01-18 01:38:48 -0400 |
commit | 670438b982bbe0b662b0a65958dc4f8b289d3906 (patch) | |
tree | 390ddabf9c802c1f38d4fd985b7e29677cb0ac66 /lux-python/source | |
parent | dfe09eb7a90dbf164bc0c78085b2d340e0928190 (diff) |
More efficient "let" and "exec" expressions.
Diffstat (limited to '')
-rw-r--r-- | lux-python/source/program.lux | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux index b63c638ca..45cc52ddc 100644 --- a/lux-python/source/program.lux +++ b/lux-python/source/program.lux @@ -409,8 +409,8 @@ (with_expansions [<jvm> (def host (IO (Host (_.Expression Any) (_.Statement Any))) (io (let [interpreter (org/python/util/PythonInterpreter::new) - evaluate! (is (-> unit.ID [(Maybe unit.ID) (_.Expression Any)] (Try Any)) - (function (evaluate! context [_ input]) + evaluate! (is (-> [(Maybe unit.ID) (_.Expression Any)] (Try Any)) + (function (evaluate! [_ input]) (do try.monad [output (org/python/util/PythonInterpreter::eval (ffi.as_string (_.code input)) interpreter)] (..read output)))) @@ -435,7 +435,7 @@ (do try.monad [.let [definition (_.set (list @global) input)] _ (execute! definition) - value (evaluate! context [@def @global])] + value (evaluate! [@def @global])] (in [global value definition])))) (def (ingest context content) @@ -450,7 +450,7 @@ (def (re_load context custom content) (do try.monad [_ (execute! content)] - (evaluate! context [{.#None} (_.var (reference.artifact context))]))))))))] + (evaluate! [{.#None} (_.var (reference.artifact context))]))))))))] (for @.old <jvm> @.jvm <jvm> @@ -462,8 +462,8 @@ (IO (Host (_.Expression Any) (_.Statement Any))) (io (is (Host (_.Expression Any) (_.Statement Any)) (let [globals (..dict []) - evaluate! (is (-> unit.ID (_.Expression Any) (Try Any)) - (function (evaluate! context input) + evaluate! (is (-> (_.Expression Any) (Try Any)) + (function (evaluate! input) (..eval [(_.code input) globals]))) execute! (is (-> (_.Statement Any) (Try Any)) (function (execute! input) @@ -475,7 +475,7 @@ (do try.monad [.let [definition (_.set (list @global) input)] _ (execute! definition) - value (evaluate! context @global)] + value (evaluate! @global)] (in [global value definition])))))] (implementation (def evaluate! evaluate!) @@ -491,7 +491,7 @@ (def (re_load context content) (do try.monad [_ (execute! content)] - (evaluate! context (_.var (reference.artifact context))))))))))))) + (evaluate! (_.var (reference.artifact context))))))))))))) (def phase_wrapper phase.Wrapper |