diff options
Diffstat (limited to 'lux-cl')
-rw-r--r-- | lux-cl/source/program.lux | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lux-cl/source/program.lux b/lux-cl/source/program.lux index d61caab05..03791e037 100644 --- a/lux-cl/source/program.lux +++ b/lux-cl/source/program.lux @@ -162,12 +162,12 @@ [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: (host_value value) +(def (host_value value) (-> Any org/armedbear/lisp/LispObject) (let [to_sub (is (-> Any org/armedbear/lisp/LispObject) (function (_ sub_value) @@ -223,7 +223,7 @@ (type: (Reader a) (-> a (Try Any))) -(def: (read_variant read host_object) +(def (read_variant read host_object) (-> (Reader org/armedbear/lisp/LispObject) (Reader org/armedbear/lisp/Cons)) (do try.monad [tag (read (org/armedbear/lisp/LispObject::NTH +0 host_object)) @@ -237,7 +237,7 @@ (is Any synthesis.unit)) value]))) -(def: (read_tuple read host_object) +(def (read_tuple read host_object) (-> (Reader org/armedbear/lisp/LispObject) (Reader org/armedbear/lisp/SimpleVector)) (let [size (.nat (org/armedbear/lisp/LispObject::length host_object))] (loop (again [idx 0 @@ -252,7 +252,7 @@ (again (++ idx) (array.write! idx (as Any member) output))) {try.#Success output})))) -(def: (read host_object) +(def (read host_object) (Reader org/armedbear/lisp/LispObject) (`` (<| (~~ (with_template [<class> <post_processing>] [(case (ffi.is <class> host_object) @@ -281,18 +281,18 @@ (exception.throw ..unknown_kind_of_object (as java/lang/Object host_object)) ))) -(def: ensure_macro +(def ensure_macro (-> Macro (Maybe org/armedbear/lisp/Closure)) (|>> (as java/lang/Object) (ffi.is org/armedbear/lisp/Closure))) -(def: (call_macro inputs lux macro) +(def (call_macro inputs lux macro) (-> (List Code) Lux org/armedbear/lisp/Closure (Try (Try [Lux (List Code)]))) (do try.monad [raw_output (org/armedbear/lisp/LispObject::execute (..host_value inputs) (..host_value lux) macro)] (as (Try (Try [Lux (List Code)])) (..read raw_output)))) -(def: (expander macro inputs lux) +(def (expander macro inputs lux) Expander (case (ensure_macro macro) {.#Some macro} @@ -301,7 +301,7 @@ {.#None} (exception.throw ..cannot_apply_a_non_function (as java/lang/Object macro)))) -(def: host +(def host (IO (Host (_.Expression Any) (_.Expression Any))) (io (let [_ (org/armedbear/lisp/Interpreter::createInstance) interpreter (org/armedbear/lisp/Interpreter::getInstance) @@ -312,13 +312,13 @@ (read host_value))))] (is (Host (_.Expression Any) (_.Expression Any)) (structure - (def: (evaluate! context code) + (def (evaluate! context code) (run! code)) - (def: (execute! input) + (def (execute! input) (org/armedbear/lisp/Interpreter::eval (_.code input) interpreter)) - (def: (define! context input) + (def (define! context input) (let [global (reference.artifact context) @global (_.var global)] (do try.monad @@ -327,19 +327,19 @@ value (run! @global)] (wrap [global value definition])))) - (def: (ingest context content) + (def (ingest context content) (|> content (at encoding.utf8 decoded) try.trusted (as (_.Expression Any)))) - (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 (Platform [_.Tag Register] (_.Expression Any) (_.Expression Any))) (do io.monad [host ..host] @@ -349,7 +349,7 @@ platform.#runtime runtime.generate platform.#write (|>> _.code (at encoding.utf8 encoded))]))) -(def: get_ecl_cli_inputs +(def get_ecl_cli_inputs (let [@idx (_.var "i")] (_.call/* (_.var "loop") (list (_.var "for") @idx @@ -357,7 +357,7 @@ (_.var "below") (_.call/* (_.var "si:argc") (list)) (_.var "collect") (_.call/* (_.var "si:argv") (list @idx)))))) -(def: (program context program) +(def (program context program) (Program (_.Expression Any) (_.Expression Any)) (let [raw_inputs (_.progn (list (_.conditional+ (list "clisp") (_.var "ext:*args*")) (_.conditional+ (list "sbcl") (_.var "sb-ext:*posix-argv*")) @@ -371,7 +371,7 @@ (_.call/2 [(runtime.lux//program_args raw_inputs) _.nil] program))) (for @.old - (def: extender + (def extender Extender ... TODO: Stop relying on coercions ASAP. (<| (as Extender) @@ -390,21 +390,21 @@ {try.#Failure "TODO: Extender"}))) @.common_lisp - (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: (then pre post) +(def (then pre post) (-> (_.Expression Any) (_.Expression Any) (_.Expression Any)) (_.manual (format (_.code pre) text.new_line (_.code post)))) -(def: (scope body) +(def (scope body) (-> (_.Expression Any) (_.Expression Any)) (let [@program (_.var "lux_program")] (all ..then |