From 9e2f1e76f2c8df01ed7687d934c3210fcf676bd6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 16 Jun 2022 00:48:19 -0400 Subject: De-sigil-ification: suffix : [Part 13] --- lux-scheme/source/program.lux | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'lux-scheme/source') diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux index c0145adf7..3a013afeb 100644 --- a/lux-scheme/source/program.lux +++ b/lux-scheme/source/program.lux @@ -137,7 +137,7 @@ "[1]::[0]" ("static" getR7rsInstance [] kawa/standard/Scheme)) -(def: (variant? value) +(def (variant? value) (-> Any Bit) (case (ffi.as [java/lang/Object] (as java/lang/Object value)) {.#Some array} @@ -171,7 +171,7 @@ [TupleValue] ) -(def: (variant_value lux_value cdr? value) +(def (variant_value lux_value cdr? value) (-> (-> java/lang/Object java/lang/Object) Bit (Array java/lang/Object) gnu/lists/Pair) (ffi.object [] gnu/lists/Pair [program/VariantValue] [] @@ -202,7 +202,7 @@ lux_value) (variant_value lux_value true value))))) -(def: (tuple_value lux_value value) +(def (tuple_value lux_value value) (-> (-> java/lang/Object java/lang/Object) (Array java/lang/Object) gnu/lists/FVector) (ffi.object [] gnu/lists/SimpleVector [program/TupleValue gnu/lists/GVector] [] @@ -246,7 +246,7 @@ "Class" (java/lang/Object::toString (java/lang/Object::getClass object)) "Object" (java/lang/Object::toString object))) -(def: (lux_value value) +(def (lux_value value) (-> java/lang/Object java/lang/Object) (<| (case (ffi.as [java/lang/Object] value) {.#Some value} @@ -261,7 +261,7 @@ (type: (Reader a) (-> a (Try Any))) -(def: (variant tag flag value) +(def (variant tag flag value) (-> Nat Bit Any Any) [(java/lang/Long::intValue (as java/lang/Long tag)) (is Any @@ -270,7 +270,7 @@ (ffi.null))) value]) -(def: (read_variant read host_object) +(def (read_variant read host_object) (-> (Reader java/lang/Object) (Reader gnu/lists/Pair)) (do try.monad [tag (read (gnu/lists/Pair::getCar host_object)) @@ -284,7 +284,7 @@ value (read (gnu/lists/Pair::getCdr host_object))] (wrap (..variant (as Nat tag) flag value)))) -(def: (read_tuple read host_object) +(def (read_tuple read host_object) (-> (Reader java/lang/Object) (Reader (gnu/lists/FVector java/lang/Object))) (let [size (.nat (gnu/lists/FVector::getBufferLength host_object))] (loop (again [idx 0 @@ -299,7 +299,7 @@ (again (++ idx) (array.write! idx (is Any lux_value) output))) {try.#Success output})))) -(def: (read host_object) +(def (read host_object) (Reader java/lang/Object) (`` (<| (~~ (with_template [] [(case (ffi.as host_object) @@ -342,11 +342,11 @@ ... else (exception.throw ..unknown_kind_of_host_object host_object)))) -(def: ensure_macro +(def ensure_macro (-> Macro (Maybe gnu/mapping/Procedure)) (|>> (as java/lang/Object) (ffi.as gnu/mapping/Procedure))) -(def: (expander macro inputs lux) +(def (expander macro inputs lux) Expander (case (..ensure_macro macro) {.#Some macro} @@ -364,7 +364,7 @@ {.#None} (exception.throw ..cannot_apply_a_non_function (as java/lang/Object macro)))) -(def: host +(def host (IO (Host _.Expression _.Expression)) (io (let [interpreter (kawa/standard/Scheme::getR7rsInstance) run! (is (-> (_.Code Any) (Try Any)) @@ -374,13 +374,13 @@ (read output))))] (is (Host _.Expression _.Expression) (structure - (def: (evaluate! context code) + (def (evaluate! context code) (run! code)) - (def: (execute! input) + (def (execute! input) (gnu/expr/Language::eval (_.code input) interpreter)) - (def: (define! context input) + (def (define! context input) (let [global (reference.artifact context) @global (_.var global)] (do try.monad @@ -389,19 +389,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))) - (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 _.Var _.Expression _.Expression)) (do io.monad [host ..host] @@ -411,7 +411,7 @@ platform.#runtime runtime.generate platform.#write (|>> _.code (at encoding.utf8 encoded))]))) -(def: (program context program) +(def (program context program) (Program _.Expression _.Expression) (_.apply/2 program ... TODO: Figure out how to always get the command-line @@ -421,7 +421,7 @@ _.nil)) (for @.old - (def: extender + (def extender Extender ... TODO: Stop relying on coercions ASAP. (<| (as Extender) @@ -446,11 +446,11 @@ (..read output)))) @.scheme - (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))) -- cgit v1.2.3