aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-09-16 20:16:22 -0400
committerEduardo Julian2021-09-16 20:16:22 -0400
commit5fdf2b62f1f97026f76c0336a225f8b510762b46 (patch)
treea99981218cf4c1f80fa49464919915c1727b0444 /stdlib/source/library/lux.lux
parentdf7321119283f4edd00e159ba619696f1c07161a (diff)
Adapted Lua, Python and Ruby compilers to the new variant format.
Diffstat (limited to 'stdlib/source/library/lux.lux')
-rw-r--r--stdlib/source/library/lux.lux88
1 files changed, 49 insertions, 39 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index a474ac1a4..3cf71545b 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -823,18 +823,52 @@
(failure "Wrong syntax for $'")}
tokens))
+... (def:'' .private (list#each f xs)
+... {#UnivQ {#End}
+... {#UnivQ {#End}
+... {#Function {#Function {#Parameter 3} {#Parameter 1}}
+... {#Function ($' List {#Parameter 3})
+... ($' List {#Parameter 1})}}}}
+... ({{#End}
+... {#End}
+
+... {#Item x xs'}
+... {#Item (f x) (list#each f xs')}}
+... xs))
+
+(def:'' .private (list#mix f init xs)
+ ... (All (_ a b) (-> (-> b a a) a (List b) a))
+ {#UnivQ {#End} {#UnivQ {#End} {#Function {#Function {#Parameter 1}
+ {#Function {#Parameter 3}
+ {#Parameter 3}}}
+ {#Function {#Parameter 3}
+ {#Function ($' List {#Parameter 1})
+ {#Parameter 3}}}}}}
+ ({{#End}
+ init
+
+ {#Item x xs'}
+ (list#mix f (f x init) xs')}
+ xs))
+
+(def:'' .private (list#reversed list)
+ {#UnivQ {#End}
+ {#Function ($' List {#Parameter 1}) ($' List {#Parameter 1})}}
+ (list#mix ("lux type check" {#UnivQ {#End}
+ {#Function {#Parameter 1} {#Function ($' List {#Parameter 1}) ($' List {#Parameter 1})}}}
+ (function'' [head tail] {#Item head tail}))
+ {#End}
+ list))
+
(def:'' .private (list#each f xs)
{#UnivQ {#End}
{#UnivQ {#End}
{#Function {#Function {#Parameter 3} {#Parameter 1}}
{#Function ($' List {#Parameter 3})
($' List {#Parameter 1})}}}}
- ({{#End}
- {#End}
-
- {#Item x xs'}
- {#Item (f x) (list#each f xs')}}
- xs))
+ (list#mix (function'' [head tail] {#Item (f head) tail})
+ {#End}
+ (list#reversed xs)))
(def:'' .private Replacement_Environment
Type
@@ -897,21 +931,6 @@
("lux type as" Int param)
("lux type as" Int subject))))
-(def:'' .private (list#mix f init xs)
- ... (All (_ a b) (-> (-> b a a) a (List b) a))
- {#UnivQ {#End} {#UnivQ {#End} {#Function {#Function {#Parameter 1}
- {#Function {#Parameter 3}
- {#Parameter 3}}}
- {#Function {#Parameter 3}
- {#Function ($' List {#Parameter 1})
- {#Parameter 3}}}}}}
- ({{#End}
- init
-
- {#Item x xs'}
- (list#mix f (f x init) xs')}
- xs))
-
(def:'' .private (list#size list)
{#UnivQ {#End}
{#Function ($' List {#Parameter 1}) Nat}}
@@ -1132,15 +1151,6 @@
{#Left "Wrong syntax for Ex"}}
tokens))
-(def:'' .private (list#reversed list)
- (All (_ a)
- {#Function ($' List a) ($' List a)})
- (list#mix ("lux type check" (All (_ a)
- {#Function a {#Function ($' List a) ($' List a)}})
- (function'' [head tail] {#Item head tail}))
- {#End}
- list))
-
(macro:' .public (-> tokens)
({{#Item output inputs}
(in_meta {#Item (list#mix ("lux type check" {#Function Code {#Function Code Code}}
@@ -4878,8 +4888,8 @@
(in (` [(~ g!meta) {<tag> (~ (untemplated_list =elems))}])))))]
[.#Form untemplated_form]
- [.#Tuple untemplated_tuple]
[.#Variant untemplated_variant]
+ [.#Tuple untemplated_tuple]
)
(def: (untemplated_pattern pattern)
@@ -4890,12 +4900,12 @@
(^template [<tag> <gen>]
[[_ {<tag> value}]
(in (` [(~ g!meta) {<tag> (~ (<gen> value))}]))])
- ([.#Bit bit$]
- [.#Nat nat$]
- [.#Int int$]
- [.#Rev rev$]
- [.#Frac frac$]
- [.#Text text$]
+ ([.#Bit bit$]
+ [.#Nat nat$]
+ [.#Int int$]
+ [.#Rev rev$]
+ [.#Frac frac$]
+ [.#Text text$]
[.#Symbol name$])
[_ {#Form {#Item [[_ {#Symbol ["" "~"]}] {#Item [unquoted {#End}]}]}}]
@@ -4945,7 +4955,7 @@
(list localT (` (..as_is (~ valueT))))))
(list#mix list#composite (list))))]
(~ bodyT)))))
-
+
{#None}
(..failure ":let requires an even number of parts"))
@@ -4981,7 +4991,7 @@
{#Some methods}
(in (list (` (..Tuple (~+ (list#each product#right methods))))
(tuple$ (list#each (|>> product#left text$) methods))))
-
+
{#None}
(failure "Wrong syntax for Interface"))))