aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2022-01-08 06:37:39 -0400
committerEduardo Julian2022-01-08 06:37:39 -0400
commit54e219ee24c1508713d07473cd8a3b04c7f8fe18 (patch)
tree704007cf63c49d54e4d642da028f12c59eea0047 /stdlib/source/library/lux.lux
parentef847d54cc6ac57bb2d470c1164ca7daeaa241b1 (diff)
Fixes for the pure-Lux JVM compiler machinery. [Part 4]
Diffstat (limited to 'stdlib/source/library/lux.lux')
-rw-r--r--stdlib/source/library/lux.lux143
1 files changed, 68 insertions, 75 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 4aed1937b..d65fa7bcb 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -895,11 +895,8 @@
{#None}
{#Item [k v] environment'}
- ({#1
- {#Some v}
-
- #0
- (replacement for environment')}
+ ({[#1] {#Some v}
+ [#0] (replacement for environment')}
(text#= k for))}
environment))
@@ -999,8 +996,8 @@
({... Jackpot!
{#Parameter id}
({id'
- ({#0 {#Parameter id'}
- #1 {#Parameter ("lux i64 -" 2 id')}}
+ ({[#0] {#Parameter id'}
+ [#1] {#Parameter ("lux i64 -" 2 id')}}
(self_id? id))}
("lux i64 -" ("lux i64 -" depth id) 0))
@@ -1072,18 +1069,19 @@
..#seed _ ..#expected _ ..#location _ ..#extensions _
..#scope_type_vars _ ..#eval _]
(list#mix (function'' [scope verdict]
- ({#1 #1
- _ ({[..#name _ ..#inner _ ..#captured _
- ..#locals [..#counter _
- ..#mappings locals]]
- (list#mix (function'' [local verdict]
- ({[local _]
- ({#1 #1 _ ("lux text =" ..quantification_level local)}
- verdict)}
- local))
- #0
- locals)}
- scope)}
+ ({[#1] #1
+ _ ({[..#name _ ..#inner _ ..#captured _
+ ..#locals [..#counter _
+ ..#mappings locals]]
+ (list#mix (function'' [local verdict]
+ ({[local _]
+ ({[#1] #1
+ _ ("lux text =" ..quantification_level local)}
+ verdict)}
+ local))
+ #0
+ locals)}
+ scope)}
verdict))
#0
scopes)}
@@ -1094,8 +1092,8 @@
{#Item body {#End}}}
{#Right [lux
{#Item ({raw
- ({#1 raw
- #0 (..quantified raw)}
+ ({[#1] raw
+ [#0] (..quantified raw)}
(initialized_quantification? lux))}
({{#End}
body
@@ -1126,8 +1124,8 @@
{#Item body {#End}}}
{#Right [lux
{#Item ({raw
- ({#1 raw
- #0 (..quantified raw)}
+ ({[#1] raw
+ [#0] (..quantified raw)}
(initialized_quantification? lux))}
({{#End}
body
@@ -1301,8 +1299,8 @@
#0
{#Item x xs'}
- ({#1 #1
- #0 (any? p xs')}
+ ({[#1] #1
+ [#0] (any? p xs')}
(p x))}
xs))
@@ -1561,40 +1559,38 @@
(def:''' .private (spliced replace? untemplated elems)
(-> Bit (-> Code ($' Meta Code)) ($' List Code) ($' Meta Code))
- ({#1
- ({{#End}
- (in_meta |#End|)
-
- {#Item lastI inits}
- (do meta_monad
- [lastO ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}]
- (in (:List<Code> spliced))
+ ({[#1] ({{#End}
+ (in_meta |#End|)
+
+ {#Item lastI inits}
+ (do meta_monad
+ [lastO ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}]
+ (in (:List<Code> spliced))
- _
- (do meta_monad
- [lastO (untemplated lastI)]
- (in (:List<Code> (|#Item| lastO |#End|))))}
- lastI)]
- (monad#mix meta_monad
- (function' [leftI rightO]
- ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}]
- (let' [g!in-module (form$ (list (text$ "lux in-module")
- (text$ ..prelude_module)
- (symbol$ [..prelude_module "list#composite"])))]
- (in (form$ (list g!in-module (:List<Code> spliced) rightO))))
-
- _
- (do meta_monad
- [leftO (untemplated leftI)]
- (in (|#Item| leftO rightO)))}
- leftI))
- lastO
- inits))}
- (list#reversed elems))
- #0
- (do meta_monad
- [=elems (monad#each meta_monad untemplated elems)]
- (in (untemplated_list =elems)))}
+ _
+ (do meta_monad
+ [lastO (untemplated lastI)]
+ (in (:List<Code> (|#Item| lastO |#End|))))}
+ lastI)]
+ (monad#mix meta_monad
+ (function' [leftI rightO]
+ ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}]
+ (let' [g!in-module (form$ (list (text$ "lux in-module")
+ (text$ ..prelude_module)
+ (symbol$ [..prelude_module "list#composite"])))]
+ (in (form$ (list g!in-module (:List<Code> spliced) rightO))))
+
+ _
+ (do meta_monad
+ [leftO (untemplated leftI)]
+ (in (|#Item| leftO rightO)))}
+ leftI))
+ lastO
+ inits))}
+ (list#reversed elems))
+ [#0] (do meta_monad
+ [=elems (monad#each meta_monad untemplated elems)]
+ (in (untemplated_list =elems)))}
replace?))
(def:''' .private (untemplated_text value)
@@ -1925,27 +1921,24 @@
(def:''' .private (digit::format digit)
(-> Nat Text)
- ({0 "0"
- 1 "1" 2 "2" 3 "3"
- 4 "4" 5 "5" 6 "6"
- 7 "7" 8 "8" 9 "9"
- _ ("lux io error" "@digit::format Undefined behavior.")}
+ ({[0] "0"
+ [1] "1" [2] "2" [3] "3"
+ [4] "4" [5] "5" [6] "6"
+ [7] "7" [8] "8" [9] "9"
+ _ ("lux io error" "@digit::format Undefined behavior.")}
digit))
(def:''' .private (nat#encoded value)
(-> Nat Text)
- ({0
- "0"
-
- _
- (let' [loop ("lux type check" (-> Nat Text Text)
- (function' again [input output]
- (if ("lux i64 =" 0 input)
- output
- (again (n// 10 input)
- (text#composite (|> input (n/% 10) digit::format)
- output)))))]
- (loop value ""))}
+ ({[0] "0"
+ _ (let' [loop ("lux type check" (-> Nat Text Text)
+ (function' again [input output]
+ (if ("lux i64 =" 0 input)
+ output
+ (again (n// 10 input)
+ (text#composite (|> input (n/% 10) digit::format)
+ output)))))]
+ (loop value ""))}
value))
(def:''' .private (int#abs value)