From 54e219ee24c1508713d07473cd8a3b04c7f8fe18 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 8 Jan 2022 06:37:39 -0400 Subject: Fixes for the pure-Lux JVM compiler machinery. [Part 4] --- stdlib/source/library/lux.lux | 143 ++++++++++++++++++++---------------------- 1 file changed, 68 insertions(+), 75 deletions(-) (limited to 'stdlib/source/library/lux.lux') 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 spliced)) + ({[#1] ({{#End} + (in_meta |#End|) + + {#Item lastI inits} + (do meta_monad + [lastO ({[_ {#Form {#Item [[_ {#Symbol ["" "~+"]}] {#Item [spliced {#End}]}]}}] + (in (:List spliced)) - _ - (do meta_monad - [lastO (untemplated lastI)] - (in (:List (|#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 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 (|#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 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) -- cgit v1.2.3