diff options
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r-- | stdlib/source/lux.lux | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 31f5165ea..d68ef26ad 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -196,7 +196,7 @@ ## (#Sum Type Type) ## (#Product Type Type) ## (#Function Type Type) -## (#Bound Nat) +## (#Parameter Nat) ## (#Var Nat) ## (#Ex Nat) ## (#UnivQ (List Type) Type) @@ -222,7 +222,7 @@ Type-Pair (+1 ## "lux.Function" Type-Pair - (+1 ## "lux.Bound" + (+1 ## "lux.Parameter" Nat (+1 ## "lux.Var" Nat @@ -246,7 +246,7 @@ (#Cons [dummy-cursor (+5 "Sum")] (#Cons [dummy-cursor (+5 "Product")] (#Cons [dummy-cursor (+5 "Function")] - (#Cons [dummy-cursor (+5 "Bound")] + (#Cons [dummy-cursor (+5 "Parameter")] (#Cons [dummy-cursor (+5 "Var")] (#Cons [dummy-cursor (+5 "Ex")] (#Cons [dummy-cursor (+5 "UnivQ")] @@ -288,8 +288,8 @@ (#Named ["lux" "Ann"] (#UnivQ #Nil (#UnivQ #Nil - (#Product (#Bound +3) - (#Bound +1))))) + (#Product (#Parameter +3) + (#Parameter +1))))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "tags"])] [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "meta")] @@ -319,9 +319,9 @@ ## (#Record (List [(w (Code' w)) (w (Code' w))]))) ("lux def" Code' (#Named ["lux" "Code'"] - ("lux case" ("lux check type" (#Apply (#Apply (#Bound +1) - (#Bound +0)) - (#Bound +1))) + ("lux case" ("lux check type" (#Apply (#Apply (#Parameter +1) + (#Parameter +0)) + (#Parameter +1))) {Code ("lux case" ("lux check type" (#Apply Code List)) {Code-List @@ -486,8 +486,8 @@ (#Product ## "lux.counter" Nat ## "lux.mappings" - (#Apply (#Product (#Bound +3) - (#Bound +1)) + (#Apply (#Product (#Parameter +3) + (#Parameter +1)) List))))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "counter") (#Cons (text$ "mappings") #Nil)))] @@ -539,9 +539,9 @@ (#UnivQ #Nil (#UnivQ #Nil (#Sum ## "lux.Left" - (#Bound +3) + (#Parameter +3) ## "lux.Right" - (#Bound +1))))) + (#Parameter +1))))) (record$ (#Cons [(tag$ ["lux" "tags"]) (tuple$ (#Cons (text$ "Left") (#Cons (text$ "Right") #Nil)))] (#Cons [(tag$ ["lux" "type-args"]) @@ -756,7 +756,7 @@ (#Named ["lux" "Meta"] (#UnivQ #Nil (#Function Lux - (#Apply (#Product Lux (#Bound +1)) + (#Apply (#Product Lux (#Parameter +1)) (#Apply Text Either))))) (record$ (#Cons [(tag$ ["lux" "doc"]) (text$ "Computations that can have access to the state of the compiler. @@ -778,10 +778,10 @@ ## Base functions & macros ("lux def" return ("lux check" (#UnivQ #Nil - (#Function (#Bound +1) + (#Function (#Parameter +1) (#Function Lux (#Apply (#Product Lux - (#Bound +1)) + (#Parameter +1)) (#Apply Text Either))))) ("lux function" _ val ("lux function" _ state @@ -793,7 +793,7 @@ (#Function Text (#Function Lux (#Apply (#Product Lux - (#Bound +1)) + (#Parameter +1)) (#Apply Text Either))))) ("lux function" _ msg ("lux function" _ state @@ -1052,9 +1052,9 @@ #Nil (#UnivQ #Nil (#UnivQ #Nil - (#Function (#Function (#Bound +3) (#Bound +1)) - (#Function ($' List (#Bound +3)) - ($' List (#Bound +1)))))) + (#Function (#Function (#Parameter +3) (#Parameter +1)) + (#Function ($' List (#Parameter +3)) + ($' List (#Parameter +1)))))) ("lux case" xs {#Nil #Nil @@ -1151,25 +1151,25 @@ ("lux coerce" Int subject) ("lux coerce" Int param)))) -(def:'' (update-bounds code) +(def:'' (update-parameters code) #Nil (#Function Code Code) ("lux case" code {[_ (#Tuple members)] - (tuple$ (list/map update-bounds members)) + (tuple$ (list/map update-parameters members)) [_ (#Record pairs)] (record$ (list/map ("lux check" (#Function (#Product Code Code) (#Product Code Code)) (function'' [pair] (let'' [name val] pair - [name (update-bounds val)]))) + [name (update-parameters val)]))) pairs)) - [_ (#Form (#Cons [_ (#Tag "lux" "Bound")] (#Cons [_ (#Nat idx)] #Nil)))] - (form$ (#Cons (tag$ ["lux" "Bound"]) (#Cons (nat$ (n/+ +2 idx)) #Nil))) + [_ (#Form (#Cons [_ (#Tag "lux" "Parameter")] (#Cons [_ (#Nat idx)] #Nil)))] + (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ (n/+ +2 idx)) #Nil))) [_ (#Form members)] - (form$ (list/map update-bounds members)) + (form$ (list/map update-parameters members)) _ code})) @@ -1192,20 +1192,20 @@ (fail "Expected symbol.")} )) -(def:'' (make-bound idx) +(def:'' (make-parameter idx) #Nil (#Function Nat Code) - (form$ (#Cons (tag$ ["lux" "Bound"]) (#Cons (nat$ idx) #Nil)))) + (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ idx) #Nil)))) (def:'' (list/fold f init xs) #Nil ## (All [a b] (-> (-> b a a) a (List b) a)) - (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Bound +1) - (#Function (#Bound +3) - (#Bound +3))) - (#Function (#Bound +3) - (#Function ($' List (#Bound +1)) - (#Bound +3)))))) + (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Parameter +1) + (#Function (#Parameter +3) + (#Parameter +3))) + (#Function (#Parameter +3) + (#Function ($' List (#Parameter +1)) + (#Parameter +3)))))) ("lux case" xs {#Nil init @@ -1216,7 +1216,7 @@ (def:'' (list/size list) #Nil (#UnivQ #Nil - (#Function ($' List (#Bound +1)) Nat)) + (#Function ($' List (#Parameter +1)) Nat)) (list/fold (function'' [_ acc] (n/+ +1 acc)) +0 list)) (macro:' #export (All tokens) @@ -1244,8 +1244,8 @@ (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "UnivQ"]) (#Cons (tag$ ["lux" "Nil"]) - (#Cons (replace-syntax (#Cons [name' (make-bound +1)] #Nil) - (update-bounds body')) #Nil)))))) + (#Cons (replace-syntax (#Cons [name' (make-parameter +1)] #Nil) + (update-parameters body')) #Nil)))))) body names) (return (#Cons ("lux case" [(text/= "" self-name) names] @@ -1256,7 +1256,7 @@ body' [false _] - (replace-syntax (#Cons [self-name (make-bound (n/* +2 (n/- +1 (list/size names))))] + (replace-syntax (#Cons [self-name (make-parameter (n/* +2 (n/- +1 (list/size names))))] #Nil) body')}) #Nil))))) @@ -1292,8 +1292,8 @@ (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "ExQ"]) (#Cons (tag$ ["lux" "Nil"]) - (#Cons (replace-syntax (#Cons [name' (make-bound +1)] #Nil) - (update-bounds body')) #Nil)))))) + (#Cons (replace-syntax (#Cons [name' (make-parameter +1)] #Nil) + (update-parameters body')) #Nil)))))) body names) (return (#Cons ("lux case" [(text/= "" self-name) names] @@ -1304,7 +1304,7 @@ body' [false _] - (replace-syntax (#Cons [self-name (make-bound (n/* +2 (n/- +1 (list/size names))))] + (replace-syntax (#Cons [self-name (make-parameter (n/* +2 (n/- +1 (list/size names))))] #Nil) body')}) #Nil))))) @@ -2964,8 +2964,8 @@ [Int (List Self)])")]) ("lux case" tokens {(#Cons [_ (#Symbol "" name)] (#Cons body #Nil)) - (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-bound +1)) (~ (make-bound +0))))]) - (update-bounds body))] + (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-parameter +1)) (~ (make-parameter +0))))]) + (update-parameters body))] (return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body'))))))) _ @@ -3698,10 +3698,10 @@ (#Function ?input ?output) (#Function (beta-reduce env ?input) (beta-reduce env ?output)) - (#Bound idx) + (#Parameter idx) (case (nth idx env) - (#Some bound) - bound + (#Some parameter) + parameter _ type) @@ -4576,7 +4576,7 @@ (#Function _) ($_ text/compose "(-> " (|> (flatten-lambda type) (list/map type/show) (interpose " ") list/reverse (list/fold text/compose "")) ")") - (#Bound id) + (#Parameter id) (nat/encode id) (#Var id) @@ -5219,7 +5219,7 @@ ([#.UnivQ] [#.ExQ]) - (#.Bound idx) + (#.Parameter idx) (default type (list.nth idx env)) _ @@ -5468,8 +5468,8 @@ (#Function in out) (` (#Function (~ (type-to-code in)) (~ (type-to-code out)))) - (#Bound idx) - (` (#Bound (~ (nat$ idx)))) + (#Parameter idx) + (` (#Parameter (~ (nat$ idx)))) (#Var id) (` (#Var (~ (nat$ id)))) @@ -5627,7 +5627,7 @@ (macro: #export (with-expansions tokens) {#.doc (doc "Controlled macro-expansion." "Bind an arbitraty number of Codes resulting from macro-expansion to local bindings." - "Wherever a binding appears, the bound Codes will be spliced in there." + "Wherever a binding appears, the bound codes will be spliced in there." (test: "Code operations & structures" (with-expansions [<tests> (do-template [<expr> <text> <pattern>] |