diff options
Diffstat (limited to 'stdlib/source/library/lux/target/scheme.lux')
-rw-r--r-- | stdlib/source/library/lux/target/scheme.lux | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux index c0632b5be..c3d1722b1 100644 --- a/stdlib/source/library/lux/target/scheme.lux +++ b/stdlib/source/library/lux/target/scheme.lux @@ -22,11 +22,11 @@ [primitive (.except)]]]]) ... Added the carriage return for better Windows compatibility. -(def: \n+ +(def \n+ Text (format text.carriage_return text.new_line)) -(def: nested +(def nested (-> Text Text) (.let [nested_new_line (format text.new_line text.tab)] (text.replaced text.new_line nested_new_line))) @@ -34,17 +34,17 @@ (primitive .public (Code k) Text - (def: .public equivalence + (def .public equivalence (All (_ brand) (Equivalence (Code brand))) (implementation - (def: (= reference subject) + (def (= reference subject) (at text.equivalence = (representation reference) (representation subject))))) - (def: .public hash + (def .public hash (All (_ brand) (Hash (Code brand))) (implementation - (def: equivalence ..equivalence) - (def: hash (|>> representation (at text.hash hash))))) + (def equivalence ..equivalence) + (def hash (|>> representation (at text.hash hash))))) (with_template [<type> <brand> <super>+] [(primitive .public (<brand> brand) Any) @@ -66,19 +66,19 @@ [#mandatory (List Var) #rest (Maybe Var)])) - (def: .public manual + (def .public manual (-> Text Code) (|>> abstraction)) - (def: .public code + (def .public code (-> (Code Any) Text) (|>> representation)) - (def: .public var + (def .public var (-> Text Var) (|>> abstraction)) - (def: (arguments [mandatory rest]) + (def (arguments [mandatory rest]) (-> Arguments (Code Any)) (case rest {.#Some rest} @@ -101,22 +101,22 @@ (text.enclosed ["(" ")"]) abstraction))) - (def: .public nil + (def .public nil Computation (abstraction "'()")) - (def: .public bool + (def .public bool (-> Bit Computation) (|>> (pipe.case #0 "#f" #1 "#t") abstraction)) - (def: .public int + (def .public int (-> Int Computation) (|>> %.int abstraction)) - (def: .public float + (def .public float (-> Frac Computation) (|>> (pipe.cond [(f.= f.positive_infinity)] [(pipe.new "+inf.0" [])] @@ -131,11 +131,11 @@ [%.frac]) abstraction)) - (def: .public positive_infinity Computation (..float f.positive_infinity)) - (def: .public negative_infinity Computation (..float f.negative_infinity)) - (def: .public not_a_number Computation (..float f.not_a_number)) + (def .public positive_infinity Computation (..float f.positive_infinity)) + (def .public negative_infinity Computation (..float f.negative_infinity)) + (def .public not_a_number Computation (..float f.not_a_number)) - (def: safe + (def safe (-> Text Text) (`` (|>> (~~ (with_template [<find> <replace>] [(text.replaced <find> <replace>)] @@ -151,15 +151,15 @@ )) ))) - (def: .public string + (def .public string (-> Text Computation) (|>> ..safe %.text abstraction)) - (def: .public symbol + (def .public symbol (-> Text Computation) (|>> (format "'") abstraction)) - (def: form + (def form (-> (List (Code Any)) Code) (.let [nested_new_line (format \n+ text.tab)] (|>> (pipe.case @@ -174,12 +174,12 @@ (text.enclosed ["(" ")"]) abstraction))))) - (def: .public (apply args func) + (def .public (apply args func) (-> (List Expression) Expression Computation) (..form {.#Item func args})) (with_template [<name> <function>] - [(def: .public (<name> members) + [(def .public (<name> members) (-> (List Expression) Computation) (..apply members (..var <function>)))] @@ -187,25 +187,25 @@ [list/* "list"] ) - (def: .public apply/0 + (def .public apply/0 (-> Expression Computation) (..apply (list))) (with_template [<lux_name> <scheme_name>] - [(def: .public <lux_name> + [(def .public <lux_name> (apply/0 (..var <scheme_name>)))] [newline/0 "newline"] ) (with_template [<apply> <arg>+ <type>+ <function>+] - [(`` (def: .public (<apply> procedure) + [(`` (def .public (<apply> procedure) (-> Expression (~~ (template.spliced <type>+)) Computation) (function (_ (~~ (template.spliced <arg>+))) (..apply (list (~~ (template.spliced <arg>+))) procedure)))) (`` (with_template [<definition> <function>] - [(def: .public <definition> (<apply> (..var <function>)))] + [(def .public <definition> (<apply> (..var <function>)))] (~~ (template.spliced <function>+))))] @@ -269,12 +269,12 @@ ... 1. To carry on, and then, when it's time to compile the compiler ... itself into Scheme, switch from 'invoke' to normal 'vector-ref'. ... Either way, the 'invoke' needs to go away. - (def: .public (vector_ref/2 vector index) + (def .public (vector_ref/2 vector index) (-> Expression Expression Computation) (..form (list (..var "invoke") vector (..symbol "getRaw") index))) (with_template [<lux_name> <scheme_name>] - [(def: .public (<lux_name> param subject) + [(def .public (<lux_name> param subject) (-> Expression Expression Computation) (..apply/2 (..var <scheme_name>) subject param))] @@ -302,7 +302,7 @@ ) (with_template [<lux_name> <scheme_name>] - [(def: .public <lux_name> + [(def .public <lux_name> (-> (List Expression) Computation) (|>> (list.partial (..var <scheme_name>)) ..form))] @@ -311,7 +311,7 @@ ) (with_template [<lux_name> <scheme_name> <var> <pre>] - [(def: .public (<lux_name> bindings body) + [(def .public (<lux_name> bindings body) (-> (List [<var> Expression]) Expression Computation) (..form (list (..var <scheme_name>) (|> bindings @@ -329,21 +329,21 @@ [letrec_values "letrec-values" Arguments ..arguments] ) - (def: .public (if test then else) + (def .public (if test then else) (-> Expression Expression Expression Computation) (..form (list (..var "if") test then else))) - (def: .public (when test then) + (def .public (when test then) (-> Expression Expression Computation) (..form (list (..var "when") test then))) - (def: .public (lambda arguments body) + (def .public (lambda arguments body) (-> Arguments Expression Computation) (..form (list (..var "lambda") (..arguments arguments) body))) - (def: .public (define_function name arguments body) + (def .public (define_function name arguments body) (-> Var Arguments Expression Computation) (..form (list (..var "define") (|> arguments @@ -351,27 +351,27 @@ ..arguments) body))) - (def: .public (define_constant name value) + (def .public (define_constant name value) (-> Var Expression Computation) (..form (list (..var "define") name value))) - (def: .public begin + (def .public begin (-> (List Expression) Computation) (|>> {.#Item (..var "begin")} ..form)) - (def: .public (set! name value) + (def .public (set! name value) (-> Var Expression Computation) (..form (list (..var "set!") name value))) - (def: .public (with_exception_handler handler body) + (def .public (with_exception_handler handler body) (-> Expression Expression Computation) (..form (list (..var "with-exception-handler") handler body))) - (def: .public (call_with_current_continuation body) + (def .public (call_with_current_continuation body) (-> Expression Computation) (..form (list (..var "call-with-current-continuation") body))) - (def: .public (guard variable clauses else body) + (def .public (guard variable clauses else body) (-> Var (List [Expression Expression]) (Maybe Expression) Expression Computation) (..form (list (..var "guard") (..form (|> (case else |