diff options
author | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-06-16 00:48:19 -0400 |
commit | 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 (patch) | |
tree | 115fab5bd8a5f53dc0d13ce5453095324a83496f /lux-r/source | |
parent | f92c806ee8da63f04bbefbf558f6249bacdb47ea (diff) |
De-sigil-ification: suffix : [Part 13]
Diffstat (limited to 'lux-r/source')
-rw-r--r-- | lux-r/source/program.lux | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/lux-r/source/program.lux b/lux-r/source/program.lux index 4a85f2c0c..1a7dbe7f4 100644 --- a/lux-r/source/program.lux +++ b/lux-r/source/program.lux @@ -181,16 +181,16 @@ [cannot_apply_a_non_function] ) -... (def: host_bit +... (def host_bit ... (-> Bit org/armedbear/lisp/LispObject) ... (|>> (pipe.case #0 (org/armedbear/lisp/Nil::NIL) ... #1 (org/armedbear/lisp/Symbol::T)))) -(def: %%code +(def %%code (syntax (_ [term <code>.any]) (wrap (list (code.text (%.code term)))))) -(def: (host_value value) +(def (host_value value) (-> Any org/renjin/sexp/SEXP) (let [... to_sub (is (-> Any org/armedbear/lisp/LispObject) ... (function (_ sub_value) @@ -356,7 +356,7 @@ (type: (Reader a) (-> a (Try Any))) -(def: (read_variant read host_object) +(def (read_variant read host_object) (-> (Reader java/lang/Object) (Reader org/renjin/sexp/ListVector)) (do try.monad [tag (|> host_object @@ -378,7 +378,7 @@ (is Any synthesis.unit)) value]))) -(def: (read_i64 host_object) +(def (read_i64 host_object) (Reader org/renjin/sexp/ListVector) (case [(|> host_object (org/renjin/sexp/ListVector::get_field runtime.i64_high_field) @@ -393,7 +393,7 @@ _ {try.#Failure ""})) -(def: (read_tuple read host_object) +(def (read_tuple read host_object) (-> (Reader java/lang/Object) (Reader org/renjin/sexp/ListVector)) (let [size (.nat (org/renjin/sexp/ListVector::length host_object))] (loop (again [idx 0 @@ -407,7 +407,7 @@ (again (++ idx) (array.write! idx (as Any member) output))) {try.#Success output})))) -(def: (field_class field host_object) +(def (field_class field host_object) (-> Text org/renjin/sexp/ListVector Text) (|> host_object (org/renjin/sexp/ListVector::get_field field) @@ -415,7 +415,7 @@ java/lang/Object::toString (as Text))) -(def: (read host_object) +(def (read host_object) (Reader java/lang/Object) (exec ... ("lux io log" (exception.construct ..unknown_kind_of_object [host_object])) @@ -454,11 +454,11 @@ (exception.throw ..unknown_kind_of_object [host_object]) )))) -(def: ensure_macro +(def ensure_macro (-> Macro (Maybe org/renjin/sexp/Closure)) (|>> (as java/lang/Object) (ffi.as org/renjin/sexp/Closure))) -(def: (call_macro interpreter inputs lux macro) +(def (call_macro interpreter inputs lux macro) (-> org/renjin/script/RenjinScriptEngine (List Code) Lux org/renjin/sexp/Closure (Try (Try [Lux (List Code)]))) (let [_ ("lux io log" "@call_macro 0") r_inputs (is org/renjin/sexp/PairList @@ -487,7 +487,7 @@ (as (Try (Try [Lux (List Code)])) (..read (as java/lang/Object raw_output)))))) -(def: (expander interpreter macro inputs lux) +(def (expander interpreter macro inputs lux) (-> org/renjin/script/RenjinScriptEngine Expander) (case (ensure_macro macro) {.#Some macro} @@ -496,7 +496,7 @@ {.#None} (exception.throw ..cannot_apply_a_non_function [(as java/lang/Object macro)]))) -(def: host +(def host (IO [org/renjin/script/RenjinScriptEngine (Host _.Expression _.Expression)]) (io (let [interpreter (|> (org/renjin/script/RenjinScriptEngineFactory::new) @@ -509,17 +509,17 @@ [(as org/renjin/script/RenjinScriptEngine interpreter) (is (Host _.Expression _.Expression) (structure - (def: (evaluate! context code) + (def (evaluate! context code) (exec ("lux io log" "@evaluate!") (run! code))) - (def: (execute! input) + (def (execute! input) (exec ("lux io log" "@execute!") ... ("lux io log" (_.code input)) (javax/script/ScriptEngine::eval (_.code input) interpreter))) - (def: (define! context input) + (def (define! context input) (let [global (reference.artifact context) $global (_.var global)] (do try.monad @@ -533,19 +533,19 @@ #let [_ ("lux io log" "@define! 2")]] (wrap [global value definition])))) - (def: (ingest context content) + (def (ingest context content) (|> content (at utf8.codec decoded) try.trusted (as _.Expression))) - (def: (re_learn context content) + (def (re_learn context content) (run! content)) - (def: (re_load context content) + (def (re_load context content) (do try.monad [_ (run! content)] (run! (_.var (reference.artifact context))))) ))]))) -(def: platform +(def platform (IO [org/renjin/script/RenjinScriptEngine (Platform _.SVar _.Expression _.Expression)]) (do io.monad @@ -557,12 +557,12 @@ platform.#runtime runtime.generate platform.#write (|>> _.code (at utf8.codec encoded))]]))) -(def: (program context program) +(def (program context program) (Program _.Expression _.Expression) (_.apply/2 program [(runtime.lux::program_args (_.commandArgs/0 [])) _.null])) (for @.old - (def: extender + (def extender Extender ... TODO: Stop relying on coercions ASAP. (<| (as Extender) @@ -581,15 +581,15 @@ {try.#Failure "TODO: Extender"}))) @.r - (def: (extender handler) + (def (extender handler) Extender (as_expected handler))) -(def: (declare_success! _) +(def (declare_success! _) (-> Any (Promise Any)) (promise.future (at world/program.default exit +0))) -(def: (scope body) +(def (scope body) (-> _.Expression _.Expression) (let [$program (_.var "lux_program")] (all _.then |