From cfa0a075b89a0df4618e7009f05c157393cbba72 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 1 Dec 2020 09:27:58 -0400 Subject: Added specialized root/2 and root/3 functions in lux/math. --- stdlib/source/lux.lux | 774 +++++++++++++++++++++++++------------------------- 1 file changed, 387 insertions(+), 387 deletions(-) (limited to 'stdlib/source/lux.lux') diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 959f6f910..639d9ab09 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -971,7 +971,7 @@ (fail "Wrong syntax for $'")} tokens)) -(def:'' (list@map f xs) +(def:'' (list\map f xs) #Nil (#UnivQ #Nil (#UnivQ #Nil @@ -982,7 +982,7 @@ #Nil (#Cons x xs') - (#Cons (f x) (list@map f xs'))} + (#Cons (f x) (list\map f xs'))} xs)) (def:'' RepEnv @@ -1000,7 +1000,7 @@ #Nil} [xs ys])) -(def:'' (text@= reference sample) +(def:'' (text\= reference sample) #Nil (#Function Text (#Function Text Bit)) ("lux text =" reference sample)) @@ -1017,7 +1017,7 @@ #0 (get-rep key env')} - (text@= k key))} + (text\= k key))} env)) (def:'' (replace-syntax reps syntax) @@ -1032,13 +1032,13 @@ (get-rep name reps)) [meta (#Form parts)] - [meta (#Form (list@map (replace-syntax reps) parts))] + [meta (#Form (list\map (replace-syntax reps) parts))] [meta (#Tuple members)] - [meta (#Tuple (list@map (replace-syntax reps) members))] + [meta (#Tuple (list\map (replace-syntax reps) members))] [meta (#Record slots)] - [meta (#Record (list@map ("lux check" (#Function (#Product Code Code) (#Product Code Code)) + [meta (#Record (list\map ("lux check" (#Function (#Product Code Code) (#Product Code Code)) (function'' [slot] ({[k v] [(replace-syntax reps k) (replace-syntax reps v)]} @@ -1061,10 +1061,10 @@ #Nil (#Function Code Code) ({[_ (#Tuple members)] - (tuple$ (list@map update-parameters members)) + (tuple$ (list\map update-parameters members)) [_ (#Record pairs)] - (record$ (list@map ("lux check" (#Function (#Product Code Code) (#Product Code Code)) + (record$ (list\map ("lux check" (#Function (#Product Code Code) (#Product Code Code)) (function'' [pair] (let'' [name val] pair [name (update-parameters val)]))) @@ -1074,7 +1074,7 @@ (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ ("lux i64 +" 2 idx)) #Nil))) [_ (#Form members)] - (form$ (list@map update-parameters members)) + (form$ (list\map update-parameters members)) _ code} @@ -1102,7 +1102,7 @@ (#Function Nat Code) (form$ (#Cons (tag$ ["lux" "Parameter"]) (#Cons (nat$ idx) #Nil)))) -(def:'' (list@fold f init xs) +(def:'' (list\fold f init xs) #Nil ## (All [a b] (-> (-> b a a) a (List b) a)) (#UnivQ #Nil (#UnivQ #Nil (#Function (#Function (#Parameter 1) @@ -1115,14 +1115,14 @@ init (#Cons x xs') - (list@fold f (f x init) xs')} + (list\fold f (f x init) xs')} xs)) -(def:'' (list@size list) +(def:'' (list\size list) #Nil (#UnivQ #Nil (#Function ($' List (#Parameter 1)) Nat)) - (list@fold (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) + (list\fold (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list)) (macro:' #export (All tokens) (#Cons [(tag$ ["lux" "doc"]) @@ -1143,7 +1143,7 @@ ({(#Cons [_ (#Tuple args)] (#Cons body #Nil)) (parse-quantified-args args (function'' [names] - (let'' body' (list@fold ("lux check" (#Function Text (#Function Code Code)) + (let'' body' (list\fold ("lux check" (#Function Text (#Function Code Code)) (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "UnivQ"]) (#Cons (tag$ ["lux" "Nil"]) @@ -1158,10 +1158,10 @@ body' [#0 _] - (replace-syntax (#Cons [self-name (make-parameter (n/* 2 ("lux i64 -" 1 (list@size names))))] + (replace-syntax (#Cons [self-name (make-parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] #Nil) body')} - [(text@= "" self-name) names]) + [(text\= "" self-name) names]) #Nil))))) _ @@ -1187,7 +1187,7 @@ ({(#Cons [_ (#Tuple args)] (#Cons body #Nil)) (parse-quantified-args args (function'' [names] - (let'' body' (list@fold ("lux check" (#Function Text (#Function Code Code)) + (let'' body' (list\fold ("lux check" (#Function Text (#Function Code Code)) (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "ExQ"]) (#Cons (tag$ ["lux" "Nil"]) @@ -1202,20 +1202,20 @@ body' [#0 _] - (replace-syntax (#Cons [self-name (make-parameter (n/* 2 ("lux i64 -" 1 (list@size names))))] + (replace-syntax (#Cons [self-name (make-parameter (n/* 2 ("lux i64 -" 1 (list\size names))))] #Nil) body')} - [(text@= "" self-name) names]) + [(text\= "" self-name) names]) #Nil))))) _ (fail "Wrong syntax for Ex")} tokens))) -(def:'' (list@reverse list) +(def:'' (list\reverse list) #Nil (All [a] (#Function ($' List a) ($' List a))) - (list@fold ("lux check" (All [a] (#Function a (#Function ($' List a) ($' List a)))) + (list\fold ("lux check" (All [a] (#Function a (#Function ($' List a) ($' List a)))) (function'' [head tail] (#Cons head tail))) #Nil list)) @@ -1229,7 +1229,7 @@ "## This is the type of a function that takes 2 Ints and returns an Int.")))] #Nil) ({(#Cons output inputs) - (return (#Cons (list@fold ("lux check" (#Function Code (#Function Code Code)) + (return (#Cons (list\fold ("lux check" (#Function Code (#Function Code Code)) (function'' [i o] (form$ (#Cons (tag$ ["lux" "Function"]) (#Cons i (#Cons o #Nil)))))) output inputs) @@ -1237,7 +1237,7 @@ _ (fail "Wrong syntax for ->")} - (list@reverse tokens))) + (list\reverse tokens))) (macro:' #export (list xs) (#Cons [(tag$ ["lux" "doc"]) @@ -1245,12 +1245,12 @@ ("lux text concat" "## List-construction macro." __paragraph) "(list +1 +2 +3)"))] #Nil) - (return (#Cons (list@fold (function'' [head tail] + (return (#Cons (list\fold (function'' [head tail] (form$ (#Cons (tag$ ["lux" "Cons"]) (#Cons (tuple$ (#Cons [head (#Cons [tail #Nil])])) #Nil)))) (tag$ ["lux" "Nil"]) - (list@reverse xs)) + (list\reverse xs)) #Nil))) (macro:' #export (list& xs) @@ -1262,7 +1262,7 @@ "(list& +1 +2 +3 (list +4 +5 +6))")))] #Nil) ({(#Cons last init) - (return (list (list@fold (function'' [head tail] + (return (list (list\fold (function'' [head tail] (form$ (list (tag$ ["lux" "Cons"]) (tuple$ (list head tail))))) last @@ -1270,7 +1270,7 @@ _ (fail "Wrong syntax for list&")} - (list@reverse xs))) + (list\reverse xs))) (macro:' #export (& tokens) (#Cons [(tag$ ["lux" "doc"]) @@ -1286,10 +1286,10 @@ (return (list (identifier$ ["lux" "Any"]))) (#Cons last prevs) - (return (list (list@fold (function'' [left right] (form$ (list (tag$ ["lux" "Product"]) left right))) + (return (list (list\fold (function'' [left right] (form$ (list (tag$ ["lux" "Product"]) left right))) last prevs)))} - (list@reverse tokens))) + (list\reverse tokens))) (macro:' #export (| tokens) (#Cons [(tag$ ["lux" "doc"]) @@ -1305,10 +1305,10 @@ (return (list (identifier$ ["lux" "Nothing"]))) (#Cons last prevs) - (return (list (list@fold (function'' [left right] (form$ (list (tag$ ["lux" "Sum"]) left right))) + (return (list (list\fold (function'' [left right] (form$ (list (tag$ ["lux" "Sum"]) left right))) last prevs)))} - (list@reverse tokens))) + (list\reverse tokens))) (macro:' (function' tokens) (let'' [name tokens'] ({(#Cons [[_ (#Identifier ["" name])] tokens']) @@ -1324,12 +1324,12 @@ (#Cons [harg targs]) (return (list (form$ (list (tuple$ (list (local-identifier$ name) harg)) - (list@fold (function'' [arg body'] + (list\fold (function'' [arg body'] (form$ (list (tuple$ (list (local-identifier$ "") arg)) body'))) body - (list@reverse targs))))))} + (list\reverse targs))))))} args) _ @@ -1404,14 +1404,14 @@ (macro:' (let' tokens) ({(#Cons [[_ (#Tuple bindings)] (#Cons [body #Nil])]) - (return (list (list@fold ("lux check" (-> (& Code Code) Code + (return (list (list\fold ("lux check" (-> (& Code Code) Code Code) (function' [binding body] ({[label value] (form$ (list (record$ (list [label body])) value))} binding))) body - (list@reverse (as-pairs bindings))))) + (list\reverse (as-pairs bindings))))) _ (fail "Wrong syntax for let'")} @@ -1446,11 +1446,11 @@ (_ann (#Form (list (_ann (#Tag ["lux" "Cons"])) token (untemplate-list tokens'))))} tokens)) -(def:''' (list@compose xs ys) +(def:''' (list\compose xs ys) #Nil (All [a] (-> ($' List a) ($' List a) ($' List a))) ({(#Cons x xs') - (#Cons x (list@compose xs' ys)) + (#Cons x (list\compose xs' ys)) #Nil ys} @@ -1460,7 +1460,7 @@ #Nil (-> Code Code Code Code) ({[_ (#Form parts)] - (form$ (list@compose parts (list a1 a2))) + (form$ (list\compose parts (list a1 a2))) _ (form$ (list op a1 a2))} @@ -1478,14 +1478,14 @@ (text$ ("lux text concat" ("lux text concat" "## Left-association for the application of binary functions over variadic arguments." ..new-line) ("lux text concat" - ("lux text concat" "(_$ text@compose ''Hello, '' name ''. How are you?'')" ..new-line) + ("lux text concat" "(_$ text\compose ''Hello, '' name ''. How are you?'')" ..new-line) ("lux text concat" ("lux text concat" "## =>" ..new-line) - "(text@compose (text@compose ''Hello, '' name) ''. How are you?'')"))))] + "(text\compose (text\compose ''Hello, '' name) ''. How are you?'')"))))] #Nil) ({(#Cons op tokens') ({(#Cons first nexts) - (return (list (list@fold (function/flip (_$_joiner op)) first nexts))) + (return (list (list\fold (function/flip (_$_joiner op)) first nexts))) _ (fail "Wrong syntax for _$")} @@ -1500,18 +1500,18 @@ (text$ ("lux text concat" ("lux text concat" "## Right-association for the application of binary functions over variadic arguments." ..new-line) ("lux text concat" - ("lux text concat" "($_ text@compose ''Hello, '' name ''. How are you?'')" ..new-line) + ("lux text concat" "($_ text\compose ''Hello, '' name ''. How are you?'')" ..new-line) ("lux text concat" ("lux text concat" "## =>" ..new-line) - "(text@compose ''Hello, '' (text@compose name ''. How are you?''))"))))] + "(text\compose ''Hello, '' (text\compose name ''. How are you?''))"))))] #Nil) ({(#Cons op tokens') ({(#Cons last prevs) - (return (list (list@fold (_$_joiner op) last prevs))) + (return (list (list\fold (_$_joiner op) last prevs))) _ (fail "Wrong syntax for $_")} - (list@reverse tokens')) + (list\reverse tokens')) _ (fail "Wrong syntax for $_")} @@ -1567,7 +1567,7 @@ ({(#Cons monad (#Cons [_ (#Tuple bindings)] (#Cons body #Nil))) (let' [g!wrap (local-identifier$ "wrap") g!bind (local-identifier$ " bind ") - body' (list@fold ("lux check" (-> (& Code Code) Code Code) + body' (list\fold ("lux check" (-> (& Code Code) Code Code) (function' [binding body'] (let' [[var value] binding] ({[_ (#Tag "" "let")] @@ -1579,7 +1579,7 @@ value))} var)))) body - (list@reverse (as-pairs bindings)))] + (list\reverse (as-pairs bindings)))] (return (list (form$ (list (record$ (list [(record$ (list [(tag$ ["lux" "wrap"]) g!wrap] [(tag$ ["lux" "bind"]) g!bind])) body'])) monad))))) @@ -1588,7 +1588,7 @@ (fail "Wrong syntax for do")} tokens)) -(def:''' (monad@map m f xs) +(def:''' (monad\map m f xs) #Nil ## (All [m a b] ## (-> (Monad m) (-> a (m b)) (List a) (m (List b)))) @@ -1604,11 +1604,11 @@ (#Cons x xs') (do m [y (f x) - ys (monad@map m f xs')] + ys (monad\map m f xs')] (wrap (#Cons y ys)))} xs))) -(def:''' (monad@fold m f y xs) +(def:''' (monad\fold m f y xs) #Nil ## (All [m a b] ## (-> (Monad m) (-> a b (m b)) b (List a) (m b))) @@ -1625,7 +1625,7 @@ (#Cons x xs') (do m [y' (f x y)] - (monad@fold m f y' xs'))} + (monad\fold m f y' xs'))} xs))) (macro:' #export (if tokens) @@ -1648,7 +1648,7 @@ (All [a] (-> Text ($' List (& Text a)) ($' Maybe a))) ({(#Cons [[k' v] plist']) - (if (text@= k k') + (if (text\= k k') (#Some v) (get k plist')) @@ -1664,7 +1664,7 @@ (list [k v]) (#Cons [[k' v'] dict']) - (if (text@= k k') + (if (text\= k k') (#Cons [[k' v] dict']) (#Cons [[k' v'] (put k v dict')]))} dict)) @@ -1677,17 +1677,17 @@ (-> Text Any) ("lux io log" message)) -(def:''' (text@compose x y) +(def:''' (text\compose x y) #Nil (-> Text Text Text) ("lux text concat" x y)) -(def:''' (name@encode full-name) +(def:''' (name\encode full-name) #Nil (-> Name Text) (let' [[module name] full-name] ({"" name - _ ($_ text@compose module "." name)} + _ ($_ text\compose module "." name)} module))) (def:''' (get-meta tag def-meta) @@ -1702,8 +1702,8 @@ _ (get-meta tag (record$ def-meta'))} - [(text@= prefix prefix') - (text@= name name')]) + [(text\= prefix prefix') + (text\= name name')]) _ (get-meta tag (record$ def-meta'))} @@ -1735,11 +1735,11 @@ constant) #None - (#Left ($_ text@compose "Unknown definition: " (name@encode full-name)))} + (#Left ($_ text\compose "Unknown definition: " (name\encode full-name)))} (get name definitions)) #None - (#Left ($_ text@compose "Unknown module: " module " @ " (name@encode full-name)))} + (#Left ($_ text\compose "Unknown module: " module " @ " (name\encode full-name)))} (get module modules)))) (def:''' (as-code-list expression) @@ -1768,12 +1768,12 @@ (wrap (as-code-list (form$ (list (tag$ ["lux" "Cons"]) (tuple$ (list lastO (tag$ ["lux" "Nil"]))))))))} lastI)] - (monad@fold meta-monad + (monad\fold meta-monad (function' [leftI rightO] ({[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] (let' [g!in-module (form$ (list (text$ "lux in-module") (text$ "lux") - (identifier$ ["lux" "list@compose"])))] + (identifier$ ["lux" "list\compose"])))] (wrap (form$ (list g!in-module (as-code-list spliced) rightO)))) _ @@ -1783,10 +1783,10 @@ leftI)) lastO inits))} - (list@reverse elems)) + (list\reverse elems)) #0 (do meta-monad - [=elems (monad@map meta-monad untemplate elems)] + [=elems (monad\map meta-monad untemplate elems)] (wrap (untemplate-list =elems)))} replace?)) @@ -1831,7 +1831,7 @@ [#1 [_ (#Identifier [module name])]] (do meta-monad [real-name ({"" - (if (text@= "" subst) + (if (text\= "" subst) (wrap [module name]) (resolve-global-identifier [subst name])) @@ -1874,7 +1874,7 @@ [_ [_ (#Record fields)]] (do meta-monad - [=fields (monad@map meta-monad + [=fields (monad\map meta-monad ("lux check" (-> (& Code Code) ($' Meta Code)) (function' [kv] (let' [[k v] kv] @@ -1967,17 +1967,17 @@ (list [(tag$ ["lux" "doc"]) (text$ ($_ "lux text concat" "## Piping macro." __paragraph - "(|> elems (list@map int@encode) (interpose '' '') (fold text@compose ''''))" __paragraph + "(|> elems (list\map int\encode) (interpose '' '') (fold text\compose ''''))" __paragraph "## =>" __paragraph - "(fold text@compose '''' (interpose '' '' (list@map int@encode elems)))"))]) + "(fold text\compose '''' (interpose '' '' (list\map int\encode elems)))"))]) ({(#Cons [init apps]) - (return (list (list@fold ("lux check" (-> Code Code Code) + (return (list (list\fold ("lux check" (-> Code Code Code) (function' [app acc] ({[_ (#Tuple parts)] - (tuple$ (list@compose parts (list acc))) + (tuple$ (list\compose parts (list acc))) [_ (#Form parts)] - (form$ (list@compose parts (list acc))) + (form$ (list\compose parts (list acc))) _ (` ((~ app) (~ acc)))} @@ -1993,17 +1993,17 @@ (list [(tag$ ["lux" "doc"]) (text$ ($_ "lux text concat" "## Reverse piping macro." __paragraph - "(<| (fold text@compose '''') (interpose '' '') (list@map int@encode) elems)" __paragraph + "(<| (fold text\compose '''') (interpose '' '') (list\map int\encode) elems)" __paragraph "## =>" __paragraph - "(fold text@compose '''' (interpose '' '' (list@map int@encode elems)))"))]) + "(fold text\compose '''' (interpose '' '' (list\map int\encode elems)))"))]) ({(#Cons [init apps]) - (return (list (list@fold ("lux check" (-> Code Code Code) + (return (list (list\fold ("lux check" (-> Code Code Code) (function' [app acc] ({[_ (#Tuple parts)] - (tuple$ (list@compose parts (list acc))) + (tuple$ (list\compose parts (list acc))) [_ (#Form parts)] - (form$ (list@compose parts (list acc))) + (form$ (list\compose parts (list acc))) _ (` ((~ app) (~ acc)))} @@ -2013,7 +2013,7 @@ _ (fail "Wrong syntax for <|")} - (list@reverse tokens))) + (list\reverse tokens))) (def:''' (compose f g) (list [(tag$ ["lux" "doc"]) @@ -2074,13 +2074,13 @@ (get-rep sname env)) [meta (#Tuple elems)] - [meta (#Tuple (list@map (apply-template env) elems))] + [meta (#Tuple (list\map (apply-template env) elems))] [meta (#Form elems)] - [meta (#Form (list@map (apply-template env) elems))] + [meta (#Form (list\map (apply-template env) elems))] [meta (#Record members)] - [meta (#Record (list@map ("lux check" (-> (& Code Code) (& Code Code)) + [meta (#Record (list\map ("lux check" (-> (& Code Code) (& Code Code)) (function' [kv] (let' [[slot value] kv] [(apply-template env slot) (apply-template env value)]))) @@ -2094,7 +2094,7 @@ #Nil (All [a] (-> (-> a Bit) ($' List a) Bit)) - (list@fold (function' [_2 _1] (if _1 (p _2) #0)) #1 xs)) + (list\fold (function' [_2 _1] (if _1 (p _2) #0)) #1 xs)) (def:''' (high-bits value) (list) @@ -2131,11 +2131,11 @@ #1 ("lux i64 =" reference sample))) -(def:''' (list@join xs) +(def:''' (list\join xs) #Nil (All [a] (-> ($' List ($' List a)) ($' List a))) - (list@fold list@compose #Nil (list@reverse xs))) + (list\fold list\compose #Nil (list\reverse xs))) (macro:' #export (template tokens) (list [(tag$ ["lux" "doc"]) @@ -2148,20 +2148,20 @@ ({(#Cons [[_ (#Tuple bindings)] (#Cons [[_ (#Tuple templates)] data])]) ({[(#Some bindings') (#Some data')] (let' [apply ("lux check" (-> RepEnv ($' List Code)) - (function' [env] (list@map (apply-template env) templates))) - num-bindings (list@size bindings')] + (function' [env] (list\map (apply-template env) templates))) + num-bindings (list\size bindings')] (if (every? (function' [size] ("lux i64 =" num-bindings size)) - (list@map list@size data')) + (list\map list\size data')) (|> data' - (list@map (compose apply (make-env bindings'))) - list@join + (list\map (compose apply (make-env bindings'))) + list\join return) (fail "Irregular arguments tuples for template."))) _ (fail "Wrong syntax for template")} - [(monad@map maybe-monad get-short bindings) - (monad@map maybe-monad tuple->list data)]) + [(monad\map maybe-monad get-short bindings) + (monad\map maybe-monad tuple->list data)]) _ (fail "Wrong syntax for template")} @@ -2201,7 +2201,7 @@ left right)) -(def:''' (bit@encode x) +(def:''' (bit\encode x) #Nil (-> Bit Text) (if x "#1" "#0")) @@ -2216,7 +2216,7 @@ _ ("lux io error" "undefined")} digit)) -(def:''' (nat@encode value) +(def:''' (nat\encode value) #Nil (-> Nat Text) ({0 @@ -2228,19 +2228,19 @@ (if ("lux i64 =" 0 input) output (recur (n// 10 input) - (text@compose (|> input (n/% 10) digit::format) + (text\compose (|> input (n/% 10) digit::format) output)))))] (loop value ""))} value)) -(def:''' (int@abs value) +(def:''' (int\abs value) #Nil (-> Int Int) (if ("lux i64 <" +0 value) ("lux i64 *" -1 value) value)) -(def:''' (int@encode value) +(def:''' (int\encode value) #Nil (-> Int Text) (if ("lux i64 =" +0 value) @@ -2251,14 +2251,14 @@ (("lux check" (-> Int Text Text) (function' recur [input output] (if ("lux i64 =" +0 input) - (text@compose sign output) + (text\compose sign output) (recur ("lux i64 /" +10 input) - (text@compose (|> input ("lux i64 %" +10) ("lux coerce" Nat) digit::format) + (text\compose (|> input ("lux i64 %" +10) ("lux coerce" Nat) digit::format) output))))) - (|> value ("lux i64 /" +10) int@abs) - (|> value ("lux i64 %" +10) int@abs ("lux coerce" Nat) digit::format))))) + (|> value ("lux i64 /" +10) int\abs) + (|> value ("lux i64 %" +10) int\abs ("lux coerce" Nat) digit::format))))) -(def:''' (frac@encode x) +(def:''' (frac\encode x) #Nil (-> Frac Text) ("lux f64 encode" x)) @@ -2303,7 +2303,7 @@ (if (macro-type? def-type) (if exported? (#Some ("lux coerce" Macro def-value)) - (if (text@= module current-module) + (if (text\= module current-module) (#Some ("lux coerce" Macro def-value)) #None)) #None)} @@ -2388,8 +2388,8 @@ ({(#Some macro) (do meta-monad [expansion (("lux coerce" Macro' macro) args) - expansion' (monad@map meta-monad macro-expand expansion)] - (wrap (list@join expansion'))) + expansion' (monad\map meta-monad macro-expand expansion)] + (wrap (list\join expansion'))) #None (return (list token))} @@ -2409,28 +2409,28 @@ ({(#Some macro) (do meta-monad [expansion (("lux coerce" Macro' macro) args) - expansion' (monad@map meta-monad macro-expand-all expansion)] - (wrap (list@join expansion'))) + expansion' (monad\map meta-monad macro-expand-all expansion)] + (wrap (list\join expansion'))) #None (do meta-monad - [args' (monad@map meta-monad macro-expand-all args)] - (wrap (list (form$ (#Cons (identifier$ macro-name) (list@join args'))))))} + [args' (monad\map meta-monad macro-expand-all args)] + (wrap (list (form$ (#Cons (identifier$ macro-name) (list\join args'))))))} ?macro)) [_ (#Form members)] (do meta-monad - [members' (monad@map meta-monad macro-expand-all members)] - (wrap (list (form$ (list@join members'))))) + [members' (monad\map meta-monad macro-expand-all members)] + (wrap (list (form$ (list\join members'))))) [_ (#Tuple members)] (do meta-monad - [members' (monad@map meta-monad macro-expand-all members)] - (wrap (list (tuple$ (list@join members'))))) + [members' (monad\map meta-monad macro-expand-all members)] + (wrap (list (tuple$ (list\join members'))))) [_ (#Record pairs)] (do meta-monad - [pairs' (monad@map meta-monad + [pairs' (monad\map meta-monad (function' [kv] (let' [[key val] kv] (do meta-monad @@ -2452,10 +2452,10 @@ #Nil (-> Code Code) ({[_ (#Form (#Cons [_ (#Tag tag)] parts))] - (form$ (#Cons [(tag$ tag) (list@map walk-type parts)])) + (form$ (#Cons [(tag$ tag) (list\map walk-type parts)])) [_ (#Tuple members)] - (` (& (~+ (list@map walk-type members)))) + (` (& (~+ (list\map walk-type members)))) [_ (#Form (#Cons [_ (#Text "lux in-module")] (#Cons [_ (#Text module)] @@ -2467,10 +2467,10 @@ expression [_ (#Form (#Cons type-fn args))] - (list@fold ("lux check" (-> Code Code Code) + (list\fold ("lux check" (-> Code Code Code) (function' [arg type-fn] (` (#.Apply (~ arg) (~ type-fn))))) (walk-type type-fn) - (list@map walk-type args)) + (list\map walk-type args)) _ type} @@ -2540,7 +2540,7 @@ (-> ($' List Code) ($' Meta (& Code ($' Maybe ($' List Text))))) ({(#Cons [_ (#Record pairs)] #Nil) (do meta-monad - [members (monad@map meta-monad + [members (monad\map meta-monad (: (-> [Code Code] (Meta [Text Code])) (function' [pair] ({[[_ (#Tag "" member-name)] member-type] @@ -2550,8 +2550,8 @@ (fail "Wrong syntax for variant case.")} pair))) pairs)] - (return [(` (& (~+ (list@map second members)))) - (#Some (list@map first members))])) + (return [(` (& (~+ (list\map second members)))) + (#Some (list\map first members))])) (#Cons type #Nil) ({[_ (#Tag "" member-name)] @@ -2566,7 +2566,7 @@ (#Cons case cases) (do meta-monad - [members (monad@map meta-monad + [members (monad\map meta-monad (: (-> Code (Meta [Text Code])) (function' [case] ({[_ (#Tag "" member-name)] @@ -2582,8 +2582,8 @@ (fail "Wrong syntax for variant case.")} case))) (list& case cases))] - (return [(` (| (~+ (list@map second members)))) - (#Some (list@map first members))])) + (return [(` (| (~+ (list\map second members)))) + (#Some (list\map first members))])) _ (fail "Improper type-definition syntax")} @@ -2602,7 +2602,7 @@ #seed ("lux i64 +" 1 seed) #expected expected #location location #extensions extensions #scope-type-vars scope-type-vars} - (local-identifier$ ($_ text@compose "__gensym__" prefix (nat@encode seed))))} + (local-identifier$ ($_ text\compose "__gensym__" prefix (nat\encode seed))))} state)) (macro:' #export (Rec tokens) @@ -2631,7 +2631,7 @@ "''YOLO'')"))]) ({(#Cons value actions) (let' [dummy (local-identifier$ "")] - (return (list (list@fold ("lux check" (-> Code Code Code) + (return (list (list\fold ("lux check" (-> Code Code Code) (function' [pre post] (` ({(~ dummy) (~ post)} (~ pre))))) value @@ -2639,7 +2639,7 @@ _ (fail "Wrong syntax for exec")} - (list@reverse tokens))) + (list\reverse tokens))) (macro:' (def:' tokens) (let' [[export? tokens'] ({(#Cons [_ (#Tag ["" "export"])] tokens') @@ -2692,61 +2692,61 @@ (let' [[left right] pair] (list left right))) -(def:' (text@encode original) +(def:' (text\encode original) (-> Text Text) - ($_ text@compose ..double-quote original ..double-quote)) + ($_ text\compose ..double-quote original ..double-quote)) -(def:' (code@encode code) +(def:' (code\encode code) (-> Code Text) ({[_ (#Bit value)] - (bit@encode value) + (bit\encode value) [_ (#Nat value)] - (nat@encode value) + (nat\encode value) [_ (#Int value)] - (int@encode value) + (int\encode value) [_ (#Rev value)] ("lux io error" "Undefined behavior.") [_ (#Frac value)] - (frac@encode value) + (frac\encode value) [_ (#Text value)] - (text@encode value) + (text\encode value) [_ (#Identifier [prefix name])] - (if (text@= "" prefix) + (if (text\= "" prefix) name - ($_ text@compose prefix "." name)) + ($_ text\compose prefix "." name)) [_ (#Tag [prefix name])] - (if (text@= "" prefix) - ($_ text@compose "#" name) - ($_ text@compose "#" prefix "." name)) + (if (text\= "" prefix) + ($_ text\compose "#" name) + ($_ text\compose "#" prefix "." name)) [_ (#Form xs)] - ($_ text@compose "(" (|> xs - (list@map code@encode) + ($_ text\compose "(" (|> xs + (list\map code\encode) (interpose " ") - list@reverse - (list@fold text@compose "")) ")") + list\reverse + (list\fold text\compose "")) ")") [_ (#Tuple xs)] - ($_ text@compose "[" (|> xs - (list@map code@encode) + ($_ text\compose "[" (|> xs + (list\map code\encode) (interpose " ") - list@reverse - (list@fold text@compose "")) "]") + list\reverse + (list\fold text\compose "")) "]") [_ (#Record kvs)] - ($_ text@compose "{" (|> kvs - (list@map (function' [kv] ({[k v] ($_ text@compose (code@encode k) " " (code@encode v))} + ($_ text\compose "{" (|> kvs + (list\map (function' [kv] ({[k v] ($_ text\compose (code\encode k) " " (code\encode v))} kv))) (interpose " ") - list@reverse - (list@fold text@compose "")) "}")} + list\reverse + (list\fold text\compose "")) "}")} code)) (def:' (expander branches) @@ -2775,11 +2775,11 @@ (do meta-monad [] (wrap (list))) _ - (fail ($_ text@compose "'lux.case' expects an even number of tokens: " (|> branches - (list@map code@encode) + (fail ($_ text\compose "'lux.case' expects an even number of tokens: " (|> branches + (list\map code\encode) (interpose " ") - list@reverse - (list@fold text@compose ""))))} + list\reverse + (list\fold text\compose ""))))} branches)) (macro:' #export (case tokens) @@ -2849,9 +2849,9 @@ _ (let' [pairs (|> patterns - (list@map (function' [pattern] (list pattern body))) - (list@join))] - (return (list@compose pairs branches)))) + (list\map (function' [pattern] (list pattern body))) + (list\join))] + (return (list\compose pairs branches)))) _ (fail "Wrong syntax for ^or"))) @@ -2874,9 +2874,9 @@ " (op x y))"))]) (case tokens (^ (list [_ (#Tuple bindings)] body)) - (if (multiple? 2 (list@size bindings)) - (|> bindings as-pairs list@reverse - (list@fold (: (-> [Code Code] Code Code) + (if (multiple? 2 (list\size bindings)) + (|> bindings as-pairs list\reverse + (list\fold (: (-> [Code Code] Code Code) (function' [lr body'] (let' [[l r] lr] (if (identifier? l) @@ -2917,7 +2917,7 @@ (` ([(~ g!name) (~ g!blank)] (.case (~ g!blank) (~ arg) (~ body'))))))))] (return (list (nest (..local-identifier$ g!name) head - (list@fold (nest g!blank) body (list@reverse tail)))))) + (list\fold (nest g!blank) body (list\reverse tail)))))) #None (fail "Wrong syntax for function"))) @@ -2951,13 +2951,13 @@ [_ (#Tuple xs)] (|> xs - (list@map process-def-meta-value) + (list\map process-def-meta-value) untemplate-list (meta-code ["lux" "Tuple"])) [_ (#Record kvs)] (|> kvs - (list@map (: (-> [Code Code] Code) + (list\map (: (-> [Code Code] Code) (function (_ [k v]) (` [(~ (process-def-meta-value k)) (~ (process-def-meta-value v))])))) @@ -2967,7 +2967,7 @@ (def:' (process-def-meta kvs) (-> (List [Code Code]) Code) - (untemplate-list (list@map (: (-> [Code Code] Code) + (untemplate-list (list\map (: (-> [Code Code] Code) (function (_ [k v]) (` [(~ (process-def-meta-value k)) (~ (process-def-meta-value v))]))) @@ -2981,14 +2981,14 @@ _ (` (#.Cons [[(~ location-code) (#.Tag ["lux" "func-args"])] - [(~ location-code) (#.Tuple (.list (~+ (list@map (function (_ arg) - (` [(~ location-code) (#.Text (~ (text$ (code@encode arg))))])) + [(~ location-code) (#.Tuple (.list (~+ (list\map (function (_ arg) + (` [(~ location-code) (#.Text (~ (text$ (code\encode arg))))])) args))))]] (~ meta))))) (def:' (with-type-args args) (-> (List Code) Code) - (` {#.type-args [(~+ (list@map (function (_ arg) (text$ (code@encode arg))) + (` {#.type-args [(~+ (list\map (function (_ arg) (text$ (code\encode arg))) args))]})) (def:' (export^ tokens) @@ -3084,7 +3084,7 @@ (-> Code Code Code) (case addition [location (#Record pairs)] - (list@fold meta-code-add base pairs) + (list\fold meta-code-add base pairs) _ base)) @@ -3174,9 +3174,9 @@ (#Some name args meta sigs) (do meta-monad [name+ (normalize name) - sigs' (monad@map meta-monad macro-expand sigs) + sigs' (monad\map meta-monad macro-expand sigs) members (: (Meta (List [Text Code])) - (monad@map meta-monad + (monad\map meta-monad (: (-> Code (Meta [Text Code])) (function (_ token) (case token @@ -3185,10 +3185,10 @@ _ (fail "Signatures require typed members!")))) - (list@join sigs'))) + (list\join sigs'))) #let [[_module _name] name+ def-name (identifier$ name) - sig-type (record$ (list@map (: (-> [Text Code] [Code Code]) + sig-type (record$ (list\map (: (-> [Text Code] [Code Code]) (function (_ [m-name m-type]) [(local-tag$ m-name) m-type])) members)) @@ -3223,9 +3223,9 @@ (template [
] [(macro: #export ( tokens) {#.doc } - (case (list@reverse tokens) + (case (list\reverse tokens) (^ (list& last init)) - (return (list (list@fold (: (-> Code Code Code) + (return (list (list\fold (: (-> Code Code Code) (function (_ pre post) (` ))) last init))) @@ -3269,7 +3269,7 @@ _ (#Left "Wrong syntax for default"))) -(def: (text@split-all-with splitter input) +(def: (text\split-all-with splitter input) (-> Text Text (List Text)) (case (..index-of splitter input) #None @@ -3277,7 +3277,7 @@ (#Some idx) (list& ("lux text clip" 0 idx input) - (text@split-all-with splitter + (text\split-all-with splitter ("lux text clip" ("lux i64 +" 1 idx) ("lux text size" input) input))))) (def: (nth idx xs) @@ -3422,7 +3422,7 @@ (#Right state module) _ - (#Left ($_ text@compose "Unknown module: " name)))))) + (#Left ($_ text\compose "Unknown module: " name)))))) (def: get-current-module (Meta Module) @@ -3440,7 +3440,7 @@ (return output) _ - (fail (text@compose "Unknown tag: " (name@encode [module name])))))) + (fail (text\compose "Unknown tag: " (name\encode [module name])))))) (def: (resolve-type-tags type) (-> Type (Meta (Maybe [(List Name) (List Type)]))) @@ -3490,7 +3490,7 @@ (macro: #export (structure tokens) {#.doc "Not meant to be used directly. Prefer 'structure:'."} (do meta-monad - [tokens' (monad@map meta-monad macro-expand tokens) + [tokens' (monad\map meta-monad macro-expand tokens) struct-type get-expected-type tags+type (resolve-type-tags struct-type) tags (: (Meta (List Name)) @@ -3501,9 +3501,9 @@ _ (fail "No tags available for type."))) #let [tag-mappings (: (List [Text Code]) - (list@map (function (_ tag) [(second tag) (tag$ tag)]) + (list\map (function (_ tag) [(second tag) (tag$ tag)]) tags))] - members (monad@map meta-monad + members (monad\map meta-monad (: (-> Code (Meta [Code Code])) (function (_ token) (case token @@ -3513,22 +3513,22 @@ (wrap [tag value]) _ - (fail (text@compose "Unknown structure member: " tag-name))) + (fail (text\compose "Unknown structure member: " tag-name))) _ (fail "Invalid structure member.")))) - (list@join tokens'))] + (list\join tokens'))] (wrap (list (record$ members))))) -(def: (text@join-with separator parts) +(def: (text\join-with separator parts) (-> Text (List Text) Text) (case parts #Nil "" (#Cons head tail) - (list@fold (function (_ right left) - ($_ text@compose left separator right)) + (list\fold (function (_ right left) + ($_ text\compose left separator right)) head tail))) @@ -3581,7 +3581,7 @@ #None (fail "Wrong syntax for structure:")))) -(def: (function@identity x) (All [a] (-> a a)) x) +(def: (function\identity x) (All [a] (-> a a)) x) (macro: #export (type: tokens) {#.doc (text$ ($_ "lux text concat" @@ -3654,7 +3654,7 @@ (` ("lux def type tagged" (~ type-name) (~ typeC) (~ total-meta) - [(~+ (list@map text$ tags))] + [(~+ (list\map text$ tags))] (~ (bit$ exported?)))) _ @@ -3703,7 +3703,7 @@ (def: (extract-defs defs) (-> (List Code) (Meta (List Text))) - (monad@map meta-monad + (monad\map meta-monad (: (-> Code (Meta Text)) (function (_ def) (case def @@ -3748,7 +3748,7 @@ (^ (list& [_ (#Form (list& [_ (#Text prefix)] structs))] parts')) (do meta-monad - [structs' (monad@map meta-monad + [structs' (monad\map meta-monad (function (_ struct) (case struct [_ (#Identifier ["" struct-name])] @@ -3809,23 +3809,23 @@ (count-relatives ("lux i64 +" 1 relatives) input) relatives))) -(def: (list@take amount list) +(def: (list\take amount list) (All [a] (-> Nat (List a) (List a))) (case [amount list] (^or [0 _] [_ #Nil]) #Nil [_ (#Cons head tail)] - (#Cons head (list@take ("lux i64 -" 1 amount) tail)))) + (#Cons head (list\take ("lux i64 -" 1 amount) tail)))) -(def: (list@drop amount list) +(def: (list\drop amount list) (All [a] (-> Nat (List a) (List a))) (case [amount list] (^or [0 _] [_ #Nil]) list [_ (#Cons _ tail)] - (list@drop ("lux i64 -" 1 amount) tail))) + (list\drop ("lux i64 -" 1 amount) tail))) (def: (clean-module nested? relative-root module) (-> Bit Text Text (Meta Text)) @@ -3836,19 +3836,19 @@ module)) relatives - (let [parts (text@split-all-with ..module-separator relative-root) + (let [parts (text\split-all-with ..module-separator relative-root) jumps ("lux i64 -" 1 relatives)] - (if (n/< (list@size parts) jumps) + (if (n/< (list\size parts) jumps) (let [prefix (|> parts - list@reverse - (list@drop jumps) - list@reverse + list\reverse + (list\drop jumps) + list\reverse (interpose ..module-separator) - (text@join-with "")) + (text\join-with "")) clean ("lux text clip" relatives ("lux text size" module) module) output (case ("lux text size" clean) 0 prefix - _ ($_ text@compose prefix ..module-separator clean))] + _ ($_ text\compose prefix ..module-separator clean))] (return output)) (fail ($_ "lux text concat" "Cannot climb the module hierarchy..." ..new-line @@ -3858,22 +3858,22 @@ (def: (alter-domain alteration domain import) (-> Nat Text Importation Importation) (let [[import-name import-alias import-refer] import - original (text@split-all-with ..module-separator import-name) - truncated (list@drop (.nat alteration) original) + original (text\split-all-with ..module-separator import-name) + truncated (list\drop (.nat alteration) original) parallel (case domain "" truncated _ (list& domain truncated))] - {#import-name (text@join-with ..module-separator parallel) + {#import-name (text\join-with ..module-separator parallel) #import-alias import-alias #import-refer import-refer})) (def: (parse-imports nested? relative-root context-alias imports) (-> Bit Text Text (List Code) (Meta (List Importation))) (do meta-monad - [imports' (monad@map meta-monad + [imports' (monad\map meta-monad (: (-> Code (Meta (List Importation))) (function (_ token) (case token @@ -3926,29 +3926,29 @@ parallel-tree]))]) (do meta-monad [parallel-imports (parse-imports nested? relative-root context-alias (list parallel-tree))] - (wrap (list@map (alter-domain alteration domain) parallel-imports))) + (wrap (list\map (alter-domain alteration domain) parallel-imports))) (^ [_ (#Record (list [[_ (#Nat alteration)] parallel-tree]))]) (do meta-monad [parallel-imports (parse-imports nested? relative-root context-alias (list parallel-tree))] - (wrap (list@map (alter-domain alteration "") parallel-imports))) + (wrap (list\map (alter-domain alteration "") parallel-imports))) (^ [_ (#Record (list [[_ (#Tag ["" domain])] parallel-tree]))]) (do meta-monad [parallel-imports (parse-imports nested? relative-root context-alias (list parallel-tree)) - #let [alteration (list@size (text@split-all-with ..module-separator domain))]] - (wrap (list@map (alter-domain alteration domain) parallel-imports))) + #let [alteration (list\size (text\split-all-with ..module-separator domain))]] + (wrap (list\map (alter-domain alteration domain) parallel-imports))) _ (do meta-monad [current-module current-module-name] - (fail ($_ text@compose + (fail ($_ text\compose "Wrong syntax for import @ " current-module - ..new-line (code@encode token))))))) + ..new-line (code\encode token))))))) imports)] - (wrap (list@join imports')))) + (wrap (list\join imports')))) (def: (exported-definitions module state) (-> Text (Meta (List Text))) @@ -3960,7 +3960,7 @@ [current-module modules])] (case (get module modules) (#Some =module) - (let [to-alias (list@map (: (-> [Text Global] + (let [to-alias (list\map (: (-> [Text Global] (List Text)) (function (_ [name definition]) (case definition @@ -3973,22 +3973,22 @@ (list))))) (let [{#module-hash _ #module-aliases _ #definitions definitions #imports _ #tags tags #types types #module-annotations _ #module-state _} =module] definitions))] - (#Right state (list@join to-alias))) + (#Right state (list\join to-alias))) #None - (#Left ($_ text@compose - "Unknown module: " (text@encode module) ..new-line + (#Left ($_ text\compose + "Unknown module: " (text\encode module) ..new-line "Current module: " (case current-module (#Some current-module) - (text@encode current-module) + (text\encode current-module) #None "???") ..new-line "Known modules: " (|> modules - (list@map (function (_ [name module]) + (list\map (function (_ [name module]) (text$ name))) tuple$ - code@encode)))) + code\encode)))) )) (def: (filter p xs) @@ -4004,9 +4004,9 @@ (def: (is-member? cases name) (-> (List Text) Text Bit) - (let [output (list@fold (function (_ case prev) + (let [output (list\fold (function (_ case prev) (or prev - (text@= case name))) + (text\= case name))) #0 cases)] output)) @@ -4034,7 +4034,7 @@ #captured {#counter _ #mappings closure}} (try-both (find (: (-> [Text [Type Any]] (Maybe Type)) (function (_ [bname [type _]]) - (if (text@= name bname) + (if (text\= name bname) (#Some type) #None)))) (: (List [Text [Type Any]]) locals) @@ -4074,12 +4074,12 @@ #scope-type-vars scope-type-vars} state] (case (get v-prefix modules) #None - (#Left (text@compose "Unknown definition: " (name@encode name))) + (#Left (text\compose "Unknown definition: " (name\encode name))) (#Some {#definitions definitions #module-hash _ #module-aliases _ #imports _ #tags tags #types types #module-annotations _ #module-state _}) (case (get v-name definitions) #None - (#Left (text@compose "Unknown definition: " (name@encode name))) + (#Left (text\compose "Unknown definition: " (name\encode name))) (#Some definition) (case definition @@ -4106,7 +4106,7 @@ [#let [[module name] full-name] current-module current-module-name] (function (_ compiler) - (let [temp (if (text@= "" module) + (let [temp (if (text\= "" module) (case (find-in-env name compiler) (#Some struct-type) (#Right [compiler struct-type]) @@ -4117,13 +4117,13 @@ (#Right [compiler struct-type]) _ - (#Left ($_ text@compose "Unknown var: " (name@encode full-name))))) + (#Left ($_ text\compose "Unknown var: " (name\encode full-name))))) (case (find-def-type full-name compiler) (#Some struct-type) (#Right [compiler struct-type]) _ - (#Left ($_ text@compose "Unknown var: " (name@encode full-name)))))] + (#Left ($_ text\compose "Unknown var: " (name\encode full-name)))))] (case temp (#Right [compiler (#Var type-id)]) (let [{#info _ #source _ #current-module _ #modules _ @@ -4156,7 +4156,7 @@ _ (list))) -(def: (type@encode type) +(def: (type\encode type) (-> Type Text) (case type (#Primitive name params) @@ -4165,41 +4165,41 @@ name _ - ($_ text@compose "(" name " " (|> params (list@map type@encode) (interpose " ") list@reverse (list@fold text@compose "")) ")")) + ($_ text\compose "(" name " " (|> params (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")")) (#Sum _) - ($_ text@compose "(| " (|> (flatten-variant type) (list@map type@encode) (interpose " ") list@reverse (list@fold text@compose "")) ")") + ($_ text\compose "(| " (|> (flatten-variant type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") (#Product _) - ($_ text@compose "[" (|> (flatten-tuple type) (list@map type@encode) (interpose " ") list@reverse (list@fold text@compose "")) "]") + ($_ text\compose "[" (|> (flatten-tuple type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) "]") (#Function _) - ($_ text@compose "(-> " (|> (flatten-lambda type) (list@map type@encode) (interpose " ") list@reverse (list@fold text@compose "")) ")") + ($_ text\compose "(-> " (|> (flatten-lambda type) (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")") (#Parameter id) - (nat@encode id) + (nat\encode id) (#Var id) - ($_ text@compose "⌈v:" (nat@encode id) "⌋") + ($_ text\compose "⌈v:" (nat\encode id) "⌋") (#Ex id) - ($_ text@compose "⟨e:" (nat@encode id) "⟩") + ($_ text\compose "⟨e:" (nat\encode id) "⟩") (#UnivQ env body) - ($_ text@compose "(All " (type@encode body) ")") + ($_ text\compose "(All " (type\encode body) ")") (#ExQ env body) - ($_ text@compose "(Ex " (type@encode body) ")") + ($_ text\compose "(Ex " (type\encode body) ")") (#Apply _) (let [[func args] (flatten-app type)] - ($_ text@compose - "(" (type@encode func) " " - (|> args (list@map type@encode) (interpose " ") list@reverse (list@fold text@compose "")) + ($_ text\compose + "(" (type\encode func) " " + (|> args (list\map type\encode) (interpose " ") list\reverse (list\fold text\compose "")) ")")) (#Named name _) - (name@encode name) + (name\encode name) )) (macro: #export (^open tokens) @@ -4221,18 +4221,18 @@ struct-evidence (resolve-type-tags init-type)] (case struct-evidence #None - (fail (text@compose "Can only 'open' structs: " (type@encode init-type))) + (fail (text\compose "Can only 'open' structs: " (type\encode init-type))) (#Some tags&members) (do meta-monad [full-body ((: (-> Name [(List Name) (List Type)] Code (Meta Code)) (function (recur source [tags members] target) - (let [locals (list@map (function (_ [t-module t-name]) + (let [locals (list\map (function (_ [t-module t-name]) ["" (de-alias "" t-name alias)]) tags) - pattern (tuple$ (list@map identifier$ locals))] + pattern (tuple$ (list\map identifier$ locals))] (do meta-monad - [enhanced-target (monad@fold meta-monad + [enhanced-target (monad\fold meta-monad (function (_ [m-local m-type] enhanced-target) (do meta-monad [m-structure (resolve-type-tags m-type)] @@ -4261,11 +4261,11 @@ __paragraph " ## else-branch" ..new-line " ''???'')"))} - (if ("lux i64 =" 0 (n/% 2 (list@size tokens))) + (if ("lux i64 =" 0 (n/% 2 (list\size tokens))) (fail "cond requires an uneven number of arguments.") - (case (list@reverse tokens) + (case (list\reverse tokens) (^ (list& else branches')) - (return (list (list@fold (: (-> [Code Code] Code Code) + (return (list (list\fold (: (-> [Code Code] Code Code) (function (_ branch else) (let [[right left] branch] (` (if (~ left) (~ right) (~ else)))))) @@ -4309,7 +4309,7 @@ g!output (gensym "")] (case (resolve-struct-type type) (#Some members) - (let [pattern (record$ (list@map (: (-> [Name [Nat Type]] [Code Code]) + (let [pattern (record$ (list\map (: (-> [Name [Nat Type]] [Code Code]) (function (_ [[r-prefix r-name] [r-idx r-type]]) [(tag$ [r-prefix r-name]) (if ("lux i64 =" idx r-idx) @@ -4322,7 +4322,7 @@ (fail "get@ can only use records."))) (^ (list [_ (#Tuple slots)] record)) - (return (list (list@fold (: (-> Code Code Code) + (return (list (list\fold (: (-> Code Code Code) (function (_ slot inner) (` (..get@ (~ slot) (~ inner))))) record @@ -4345,7 +4345,7 @@ #let [g!output (local-identifier$ short) pattern (|> tags enumeration - (list@map (function (_ [tag-idx tag]) + (list\map (function (_ [tag-idx tag]) (if ("lux i64 =" my-tag-index tag-idx) g!output g!_))) @@ -4354,12 +4354,12 @@ (case output (#Some [tags' members']) (do meta-monad - [decls' (monad@map meta-monad + [decls' (monad\map meta-monad (: (-> [Nat Name Type] (Meta (List Code))) (function (_ [sub-tag-index sname stype]) (open-field alias tags' sub-tag-index sname source+ stype))) (enumeration (zip/2 tags' members')))] - (return (list@join decls'))) + (return (list\join decls'))) _ (return (list (` ("lux def" (~ (local-identifier$ (de-alias "" short alias))) @@ -4390,14 +4390,14 @@ (case output (#Some [tags members]) (do meta-monad - [decls' (monad@map meta-monad (: (-> [Nat Name Type] (Meta (List Code))) + [decls' (monad\map meta-monad (: (-> [Nat Name Type] (Meta (List Code))) (function (_ [tag-index sname stype]) (open-field alias tags tag-index sname source stype))) (enumeration (zip/2 tags members)))] - (return (list@join decls'))) + (return (list\join decls'))) _ - (fail (text@compose "Can only 'open:' structs: " (type@encode struct-type))))) + (fail (text\compose "Can only 'open:' structs: " (type\encode struct-type))))) _ (do meta-monad @@ -4413,9 +4413,9 @@ (macro: #export (|>> tokens) {#.doc (text$ ($_ "lux text concat" "## Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..new-line - "(|>> (list@map int@encode) (interpose '' '') (fold text@compose ''''))" ..new-line + "(|>> (list\map int\encode) (interpose '' '') (fold text\compose ''''))" ..new-line "## =>" ..new-line - "(function (_ ) (fold text@compose '''' (interpose '' '' (list@map int@encode ))))"))} + "(function (_ ) (fold text\compose '''' (interpose '' '' (list\map int\encode ))))"))} (do meta-monad [g!_ (gensym "_") g!arg (gensym "arg")] @@ -4424,9 +4424,9 @@ (macro: #export (<<| tokens) {#.doc (text$ ($_ "lux text concat" "## Similar to the piping macro, but rather than taking an initial object to work on, creates a function for taking it." ..new-line - "(<<| (fold text@compose '''') (interpose '' '') (list@map int@encode))" ..new-line + "(<<| (fold text\compose '''') (interpose '' '') (list\map int\encode))" ..new-line "## =>" ..new-line - "(function (_ ) (fold text@compose '''' (interpose '' '' (list@map int@encode ))))"))} + "(function (_ ) (fold text\compose '''' (interpose '' '' (list\map int\encode ))))"))} (do meta-monad [g!_ (gensym "_") g!arg (gensym "arg")] @@ -4453,11 +4453,11 @@ #refer-open openings}) _ - (fail ($_ text@compose "Wrong syntax for refer @ " current-module + (fail ($_ text\compose "Wrong syntax for refer @ " current-module ..new-line (|> options - (list@map code@encode) + (list\map code\encode) (interpose " ") - (list@fold text@compose ""))))))) + (list\fold text\compose ""))))))) (def: (write-refer module-name [r-defs r-opens]) (-> Text Refer (Meta (List Code))) @@ -4465,12 +4465,12 @@ [current-module current-module-name #let [test-referrals (: (-> Text (List Text) (List Text) (Meta (List Any))) (function (_ module-name all-defs referred-defs) - (monad@map meta-monad + (monad\map meta-monad (: (-> Text (Meta Any)) (function (_ _def) (if (is-member? all-defs _def) (return []) - (fail ($_ text@compose _def " is not defined in module " module-name " @ " current-module))))) + (fail ($_ text\compose _def " is not defined in module " module-name " @ " current-module))))) referred-defs)))] defs' (case r-defs #All @@ -4493,18 +4493,18 @@ #Nothing (wrap (list))) - #let [defs (list@map (: (-> Text Code) + #let [defs (list\map (: (-> Text Code) (function (_ def) (` ("lux def alias" (~ (local-identifier$ def)) (~ (identifier$ [module-name def])))))) defs') openings (|> r-opens - (list@map (: (-> Openings (List Code)) + (list\map (: (-> Openings (List Code)) (function (_ [alias structs]) - (list@map (function (_ name) + (list\map (function (_ name) (` (open: (~ (text$ alias)) (~ (identifier$ [module-name name]))))) structs)))) - list@join)]] - (wrap (list@compose defs openings)) + list\join)]] + (wrap (list\compose defs openings)) )) (macro: #export (refer tokens) @@ -4526,19 +4526,19 @@ (list (' #*)) (#Only defs) - (list (form$ (list& (' #+) (list@map local-identifier$ defs)))) + (list (form$ (list& (' #+) (list\map local-identifier$ defs)))) (#Exclude defs) - (list (form$ (list& (' #-) (list@map local-identifier$ defs)))) + (list (form$ (list& (' #-) (list\map local-identifier$ defs)))) #Ignore (list) #Nothing (list))) - openings (list@map (function (_ [alias structs]) + openings (list\map (function (_ [alias structs]) (form$ (list& (text$ (..replace-all ..contextual-reference module-alias alias)) - (list@map local-identifier$ structs)))) + (list\map local-identifier$ structs)))) r-opens)] (` (..refer (~ (text$ module-name)) (~+ localizations) @@ -4573,11 +4573,11 @@ current-module current-module-name imports (parse-imports #0 current-module "" _imports) #let [=imports (|> imports - (list@map (: (-> Importation Code) + (list\map (: (-> Importation Code) (function (_ [m-name m-alias =refer]) (` [(~ (text$ m-name)) (~ (text$ (default "" m-alias)))])))) tuple$) - =refers (list@map (: (-> Importation Code) + =refers (list\map (: (-> Importation Code) (function (_ [m-name m-alias =refer]) (refer-to-code m-name m-alias =refer))) imports) @@ -4623,19 +4623,19 @@ (case (resolve-struct-type type) (#Some members) (do meta-monad - [pattern' (monad@map meta-monad + [pattern' (monad\map meta-monad (: (-> [Name [Nat Type]] (Meta [Name Nat Code])) (function (_ [r-slot-name [r-idx r-type]]) (do meta-monad [g!slot (gensym "")] (return [r-slot-name r-idx g!slot])))) (zip/2 tags (enumeration members)))] - (let [pattern (record$ (list@map (: (-> [Name Nat Code] [Code Code]) + (let [pattern (record$ (list\map (: (-> [Name Nat Code] [Code Code]) (function (_ [r-slot-name r-idx r-var]) [(tag$ r-slot-name) r-var])) pattern')) - output (record$ (list@map (: (-> [Name Nat Code] [Code Code]) + output (record$ (list\map (: (-> [Name Nat Code] [Code Code]) (function (_ [r-slot-name r-idx r-var]) [(tag$ r-slot-name) (if ("lux i64 =" idx r-idx) @@ -4654,23 +4654,23 @@ _ (do meta-monad - [bindings (monad@map meta-monad + [bindings (monad\map meta-monad (: (-> Code (Meta Code)) (function (_ _) (gensym "temp"))) slots) #let [pairs (zip/2 slots bindings) - update-expr (list@fold (: (-> [Code Code] Code Code) + update-expr (list\fold (: (-> [Code Code] Code Code) (function (_ [s b] v) (` (..set@ (~ s) (~ v) (~ b))))) value - (list@reverse pairs)) - [_ accesses'] (list@fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) + (list\reverse pairs)) + [_ accesses'] (list\fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) (function (_ [new-slot new-binding] [old-record accesses']) [(` (get@ (~ new-slot) (~ new-binding))) (#Cons (list new-binding old-record) accesses')])) [record (: (List (List Code)) #Nil)] pairs) - accesses (list@join (list@reverse accesses'))]] + accesses (list\join (list\reverse accesses'))]] (wrap (list (` (let [(~+ accesses)] (~ update-expr))))))) @@ -4710,19 +4710,19 @@ (case (resolve-struct-type type) (#Some members) (do meta-monad - [pattern' (monad@map meta-monad + [pattern' (monad\map meta-monad (: (-> [Name [Nat Type]] (Meta [Name Nat Code])) (function (_ [r-slot-name [r-idx r-type]]) (do meta-monad [g!slot (gensym "")] (return [r-slot-name r-idx g!slot])))) (zip/2 tags (enumeration members)))] - (let [pattern (record$ (list@map (: (-> [Name Nat Code] [Code Code]) + (let [pattern (record$ (list\map (: (-> [Name Nat Code] [Code Code]) (function (_ [r-slot-name r-idx r-var]) [(tag$ r-slot-name) r-var])) pattern')) - output (record$ (list@map (: (-> [Name Nat Code] [Code Code]) + output (record$ (list\map (: (-> [Name Nat Code] [Code Code]) (function (_ [r-slot-name r-idx r-var]) [(tag$ r-slot-name) (if ("lux i64 =" idx r-idx) @@ -4770,7 +4770,7 @@ " (-> (List Type) Type Type)" ..new-line " (case type" ..new-line " (#.Primitive name params)" ..new-line - " (#.Primitive name (list@map (beta-reduce env) params))" + " (#.Primitive name (list\map (beta-reduce env) params))" __paragraph " (^template []" ..new-line " [( left right)" ..new-line @@ -4805,20 +4805,20 @@ branches)) (case (: (Maybe (List Code)) (do maybe-monad - [bindings' (monad@map maybe-monad get-short bindings) - data' (monad@map maybe-monad tuple->list data)] - (let [num-bindings (list@size bindings')] + [bindings' (monad\map maybe-monad get-short bindings) + data' (monad\map maybe-monad tuple->list data)] + (let [num-bindings (list\size bindings')] (if (every? (|>> ("lux i64 =" num-bindings)) - (list@map list@size data')) + (list\map list\size data')) (let [apply (: (-> RepEnv (List Code)) - (function (_ env) (list@map (apply-template env) templates)))] + (function (_ env) (list\map (apply-template env) templates)))] (|> data' - (list@map (compose apply (make-env bindings'))) - list@join + (list\map (compose apply (make-env bindings'))) + list\join wrap)) #None)))) (#Some output) - (return (list@compose output branches)) + (return (list\compose output branches)) #None (fail "Wrong syntax for ^template")) @@ -4843,14 +4843,14 @@ (^template [] [[[_ _ column] ( parts)] - (list@fold n/min column (list@map find-baseline-column parts))]) + (list\fold n/min column (list\map find-baseline-column parts))]) ([#Form] [#Tuple]) [[_ _ column] (#Record pairs)] - (list@fold n/min column - (list@compose (list@map (|>> first find-baseline-column) pairs) - (list@map (|>> second find-baseline-column) pairs))) + (list\fold n/min column + (list\compose (list\map (|>> first find-baseline-column) pairs) + (list\map (|>> second find-baseline-column) pairs))) )) (type: Doc-Fragment @@ -4876,9 +4876,9 @@ [dec "lux i64 -" "Decrement function."] ) -(def: tag@encode +(def: tag\encode (-> Name Text) - (|>> name@encode (text@compose "#"))) + (|>> name\encode (text\compose "#"))) (def: (repeat n x) (All [a] (-> Int a (List a))) @@ -4889,18 +4889,18 @@ (def: (location-padding baseline [_ old-line old-column] [_ new-line new-column]) (-> Nat Location Location Text) (if ("lux i64 =" old-line new-line) - (text@join-with "" (repeat (.int ("lux i64 -" old-column new-column)) " ")) - (let [extra-lines (text@join-with "" (repeat (.int ("lux i64 -" old-line new-line)) ..new-line)) - space-padding (text@join-with "" (repeat (.int ("lux i64 -" baseline new-column)) " "))] - (text@compose extra-lines space-padding)))) + (text\join-with "" (repeat (.int ("lux i64 -" old-column new-column)) " ")) + (let [extra-lines (text\join-with "" (repeat (.int ("lux i64 -" old-line new-line)) ..new-line)) + space-padding (text\join-with "" (repeat (.int ("lux i64 -" baseline new-column)) " "))] + (text\compose extra-lines space-padding)))) -(def: (text@size x) +(def: (text\size x) (-> Text Nat) ("lux text size" x)) (def: (update-location [file line column] code-text) (-> Location Text Location) - [file line ("lux i64 +" column (text@size code-text))]) + [file line ("lux i64 +" column (text\size code-text))]) (def: (delim-update-location [file line column]) (-> Location Location) @@ -4908,7 +4908,7 @@ (def: rejoin-all-pairs (-> (List [Code Code]) (List Code)) - (|>> (list@map rejoin-pair) list@join)) + (|>> (list\map rejoin-pair) list\join)) (def: (doc-example->Text prev-location baseline example) (-> Location Nat Code [Location Text]) @@ -4917,30 +4917,30 @@ [[new-location ( value)] (let [as-text ( value)] [(update-location new-location as-text) - (text@compose (location-padding baseline prev-location new-location) + (text\compose (location-padding baseline prev-location new-location) as-text)])]) - ([#Bit bit@encode] - [#Nat nat@encode] - [#Int int@encode] - [#Frac frac@encode] - [#Text text@encode] - [#Identifier name@encode] - [#Tag tag@encode]) + ([#Bit bit\encode] + [#Nat nat\encode] + [#Int int\encode] + [#Frac frac\encode] + [#Text text\encode] + [#Identifier name\encode] + [#Tag tag\encode]) (^template [ ] [[group-location ( parts)] - (let [[group-location' parts-text] (list@fold (function (_ part [last-location text-accum]) + (let [[group-location' parts-text] (list\fold (function (_ part [last-location text-accum]) (let [[part-location part-text] (doc-example->Text last-location baseline part)] - [part-location (text@compose text-accum part-text)])) + [part-location (text\compose text-accum part-text)])) [(delim-update-location group-location) ""] ( parts))] [(delim-update-location group-location') - ($_ text@compose (location-padding baseline prev-location group-location) + ($_ text\compose (location-padding baseline prev-location group-location) parts-text )])]) - ([#Form "(" ")" ..function@identity] - [#Tuple "[" "]" ..function@identity] + ([#Form "(" ")" ..function\identity] + [#Tuple "[" "]" ..function\identity] [#Record "{" "}" rejoin-all-pairs]) [new-location (#Rev value)] @@ -4956,15 +4956,15 @@ (case fragment (#Doc-Comment comment) (|> comment - (text@split-all-with ..new-line) - (list@map (function (_ line) ($_ text@compose "## " line ..new-line))) - (text@join-with "")) + (text\split-all-with ..new-line) + (list\map (function (_ line) ($_ text\compose "## " line ..new-line))) + (text\join-with "")) (#Doc-Example example) (let [baseline (find-baseline-column example) [location _] example [_ text] (doc-example->Text (with-baseline baseline location) baseline example)] - (text@compose text __paragraph)))) + (text\compose text __paragraph)))) (macro: #export (doc tokens) {#.doc (text$ ($_ "lux text concat" @@ -4980,8 +4980,8 @@ " x)))"))} (return (list (` [(~ location-code) (#.Text (~ (|> tokens - (list@map (|>> identify-doc-fragment doc-fragment->Text)) - (text@join-with "") + (list\map (|>> identify-doc-fragment doc-fragment->Text)) + (text\join-with "") text$)))])))) (def: (interleave xs ys) @@ -5002,7 +5002,7 @@ (-> Type Code) (case type (#Primitive name params) - (` (#.Primitive (~ (text$ name)) (~ (untemplate-list (list@map type-to-code params))))) + (` (#.Primitive (~ (text$ name)) (~ (untemplate-list (list\map type-to-code params))))) (^template [] [( left right) @@ -5018,7 +5018,7 @@ (^template [] [( env type) - (let [env' (untemplate-list (list@map type-to-code env))] + (let [env' (untemplate-list (list\map type-to-code env))] (` ( (~ env') (~ (type-to-code type)))))]) ([#.UnivQ] [#.ExQ]) @@ -5057,23 +5057,23 @@ (case ?params (#.Some [name bindings body]) (let [pairs (as-pairs bindings) - vars (list@map first pairs) - inits (list@map second pairs)] + vars (list\map first pairs) + inits (list\map second pairs)] (if (every? identifier? inits) (do meta-monad [inits' (: (Meta (List Name)) - (case (monad@map maybe-monad get-name inits) + (case (monad\map maybe-monad get-name inits) (#Some inits') (return inits') #None (fail "Wrong syntax for loop"))) - init-types (monad@map meta-monad find-type inits') + init-types (monad\map meta-monad find-type inits') expected get-expected-type] - (return (list (` (("lux check" (-> (~+ (list@map type-to-code init-types)) + (return (list (` (("lux check" (-> (~+ (list\map type-to-code init-types)) (~ (type-to-code expected))) (function ((~ name) (~+ vars)) (~ body))) (~+ inits)))))) (do meta-monad - [aliases (monad@map meta-monad + [aliases (monad\map meta-monad (: (-> Code (Meta Code)) (function (_ _) (gensym ""))) inits)] @@ -5097,7 +5097,7 @@ (case (: (Maybe [Name (List Name)]) (do maybe-monad [hslot (get-tag hslot') - tslots (monad@map maybe-monad get-tag tslots')] + tslots (monad\map maybe-monad get-tag tslots')] (wrap [hslot tslots]))) (#Some slots) (return slots) @@ -5106,15 +5106,15 @@ (fail "Wrong syntax for ^slots"))) #let [[hslot tslots] slots] hslot (normalize hslot) - tslots (monad@map meta-monad normalize tslots) + tslots (monad\map meta-monad normalize tslots) output (resolve-tag hslot) g!_ (gensym "_") #let [[idx tags exported? type] output - slot-pairings (list@map (: (-> Name [Text Code]) + slot-pairings (list\map (: (-> Name [Text Code]) (function (_ [module name]) [name (local-identifier$ name)])) (list& hslot tslots)) - pattern (record$ (list@map (: (-> Name [Code Code]) + pattern (record$ (list\map (: (-> Name [Code Code]) (function (_ [module name]) (let [tag (tag$ [module name])] (case (get name slot-pairings) @@ -5133,22 +5133,22 @@ (#Some (list target)) [_ (#Identifier [prefix name])] - (if (and (text@= "" prefix) - (text@= label name)) + (if (and (text\= "" prefix) + (text\= label name)) (#Some tokens) (#Some (list target))) (^template [] [[location ( elems)] (do maybe-monad - [placements (monad@map maybe-monad (place-tokens label tokens) elems)] - (wrap (list [location ( (list@join placements))])))]) + [placements (monad\map maybe-monad (place-tokens label tokens) elems)] + (wrap (list [location ( (list\join placements))])))]) ([#Tuple] [#Form]) [location (#Record pairs)] (do maybe-monad - [=pairs (monad@map maybe-monad + [=pairs (monad\map maybe-monad (: (-> [Code Code] (Maybe [Code Code])) (function (_ [slot value]) (do maybe-monad @@ -5249,13 +5249,13 @@ ["Text" Text text$]) _ - (fail (text@compose "Cannot anti-quote type: " (name@encode name)))))) + (fail (text\compose "Cannot anti-quote type: " (name\encode name)))))) (def: (anti-quote token) (-> Code (Meta Code)) (case token [_ (#Identifier [def-prefix def-name])] - (if (text@= "" def-prefix) + (if (text\= "" def-prefix) (do meta-monad [current-module current-module-name] (anti-quote-def [current-module def-name])) @@ -5264,14 +5264,14 @@ (^template [] [[meta ( parts)] (do meta-monad - [=parts (monad@map meta-monad anti-quote parts)] + [=parts (monad\map meta-monad anti-quote parts)] (wrap [meta ( =parts)]))]) ([#Form] [#Tuple]) [meta (#Record pairs)] (do meta-monad - [=pairs (monad@map meta-monad + [=pairs (monad\map meta-monad (: (-> [Code Code] (Meta [Code Code])) (function (_ [slot value]) (do meta-monad @@ -5315,12 +5315,12 @@ (#Cons init extras) (do meta-monad - [extras' (monad@map meta-monad case-level^ extras)] + [extras' (monad\map meta-monad case-level^ extras)] (wrap [init extras'])))) (def: (multi-level-case$ g!_ [[init-pattern levels] body]) (-> Code [Multi-Level-Case Code] (List Code)) - (let [inner-pattern-body (list@fold (function (_ [calculation pattern] success) + (let [inner-pattern-body (list\fold (function (_ [calculation pattern] success) (let [bind? (case pattern [_ (#.Identifier _)] #1 @@ -5335,7 +5335,7 @@ (list) (list g!_ (` #.None)))))))) (` (#.Some (~ body))) - (: (List [Code Code]) (list@reverse levels)))] + (: (List [Code Code]) (list\reverse levels)))] (list init-pattern inner-pattern-body))) (macro: #export (^multi tokens) @@ -5343,7 +5343,7 @@ "Useful in situations where the result of a branch depends on further refinements on the values being matched." "For example:" (case (split (size static) uri) - (^multi (#.Some [chunk uri']) [(text@= static chunk) #1]) + (^multi (#.Some [chunk uri']) [(text\= static chunk) #1]) (match-uri endpoint? parts' uri') _ @@ -5352,7 +5352,7 @@ "Short-cuts can be taken when using bit tests." "The example above can be rewritten as..." (case (split (size static) uri) - (^multi (#.Some [chunk uri']) (text@= static chunk)) + (^multi (#.Some [chunk uri']) (text\= static chunk)) (match-uri endpoint? parts' uri') _ @@ -5393,8 +5393,8 @@ ## 'wrong-syntax-error' for easier maintenance of the error-messages. (def: wrong-syntax-error (-> Name Text) - (|>> name@encode - (text@compose "Wrong syntax for "))) + (|>> name\encode + (text\compose "Wrong syntax for "))) (macro: #export (name-of tokens) {#.doc (doc "Given an identifier or a tag, gives back a 2 tuple with the prefix and name parts, both as Text." @@ -5436,7 +5436,7 @@ "In the example below, 0 corresponds to the 'a' variable." (def: #export (from-list list) (All [a] (-> (List a) (Row a))) - (list@fold add + (list\fold add (: (Row ($ 0)) empty) list)))} @@ -5444,12 +5444,12 @@ (^ (list [_ (#Nat idx)])) (do meta-monad [stvs get-scope-type-vars] - (case (list-at idx (list@reverse stvs)) + (case (list-at idx (list\reverse stvs)) (#Some var-id) (wrap (list (` (#Ex (~ (nat$ var-id)))))) #None - (fail (text@compose "Indexed-type does not exist: " (nat@encode idx))))) + (fail (text\compose "Indexed-type does not exist: " (nat\encode idx))))) _ (fail (..wrong-syntax-error (name-of ..$))))) @@ -5468,7 +5468,7 @@ (macro: #export (^@ tokens) {#.doc (doc "Allows you to simultaneously bind and de-structure a value." (def: (hash (^@ set [Hash _])) - (list@fold (function (_ elem acc) (+ (:: Hash hash elem) acc)) + (list\fold (function (_ elem acc) (+ (:: Hash hash elem) acc)) 0 (to-list set))))} (case tokens @@ -5555,7 +5555,7 @@ (case tokens (^ (list& [_ (#Form (list& [_ (#Identifier ["" name])] args'))] tokens')) (do meta-monad - [args (monad@map meta-monad + [args (monad\map meta-monad (function (_ arg') (case arg' [_ (#Identifier ["" arg-name])] @@ -5627,7 +5627,7 @@ g!tokens (gensym "tokens") g!compiler (gensym "compiler") g!_ (gensym "_") - #let [rep-env (list@map (function (_ arg) + #let [rep-env (list\map (function (_ arg) [arg (` ((~' ~) (~ (local-identifier$ arg))))]) args)] this-module current-module-name] @@ -5635,9 +5635,9 @@ ((~ (local-identifier$ name)) (~ g!tokens) (~ g!compiler)) (~ anns) (case (~ g!tokens) - (^ (list (~+ (list@map local-identifier$ args)))) + (^ (list (~+ (list\map local-identifier$ args)))) (#.Right [(~ g!compiler) - (list (~+ (list@map (function (_ template) + (list (~+ (list\map (function (_ template) (` (`' (~ (replace-syntax rep-env template))))) input-templates)))]) @@ -5671,7 +5671,7 @@ #Nil (case default #.None - (fail ($_ text@compose "No code for target platform: " target)) + (fail ($_ text\compose "No code for target platform: " target)) (#.Some default) (return (list default))) @@ -5680,7 +5680,7 @@ (with-expansions [ (target-pick target options' default)] (case key [_ (#Text platform)] - (if (text@= target platform) + (if (text\= target platform) (return (list pick)) ) @@ -5691,14 +5691,14 @@ #let [[type value] type+value]] (case (..flatten-alias type) (#Named ["lux" "Text"] (#Primitive "#Text" #Nil)) - (if (text@= target (:coerce ..Text value)) + (if (text\= target (:coerce ..Text value)) (wrap (list pick)) ) _ - (fail ($_ text@compose - "Invalid target platform (must be a value of type Text): " (name@encode identifier) - " : " (..code@encode (..type-to-code type)))))) + (fail ($_ text\compose + "Invalid target platform (must be a value of type Text): " (name\encode identifier) + " : " (..code\encode (..type-to-code type)))))) _ )) @@ -5737,24 +5737,24 @@ (^template [] [[ann ( parts)] (do meta-monad - [=parts (monad@map meta-monad label-code parts)] - (wrap [(list@fold list@compose (list) (list@map left =parts)) - [ann ( (list@map right =parts))]]))]) + [=parts (monad\map meta-monad label-code parts)] + (wrap [(list\fold list\compose (list) (list\map left =parts)) + [ann ( (list\map right =parts))]]))]) ([#Form] [#Tuple]) [ann (#Record kvs)] (do meta-monad - [=kvs (monad@map meta-monad + [=kvs (monad\map meta-monad (function (_ [key val]) (do meta-monad [=key (label-code key) =val (label-code val) #let [[key-labels key-labelled] =key [val-labels val-labelled] =val]] - (wrap [(list@compose key-labels val-labels) [key-labelled val-labelled]]))) + (wrap [(list\compose key-labels val-labels) [key-labelled val-labelled]]))) kvs)] - (wrap [(list@fold list@compose (list) (list@map left =kvs)) - [ann (#Record (list@map right =kvs))]])) + (wrap [(list\fold list\compose (list) (list\map left =kvs)) + [ann (#Record (list\map right =kvs))]])) _ (return [(list) code]))) @@ -5766,8 +5766,8 @@ [=raw (label-code raw) #let [[labels labelled] =raw]] (wrap (list (` (with-expansions [(~+ (|> labels - (list@map (function (_ [label expansion]) (list label expansion))) - list@join))] + (list\map (function (_ [label expansion]) (list label expansion))) + list\join))] (~ labelled)))))) _ @@ -5806,7 +5806,7 @@ [_ (#Record fields)] (do meta-monad - [=fields (monad@map meta-monad + [=fields (monad\map meta-monad (function (_ [key value]) (do meta-monad [=key (untemplate-pattern key) @@ -5824,17 +5824,17 @@ (^template [] [[_ ( elems)] - (case (list@reverse elems) + (case (list\reverse elems) (#Cons [_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] inits) (do meta-monad - [=inits (monad@map meta-monad untemplate-pattern (list@reverse inits)) + [=inits (monad\map meta-monad untemplate-pattern (list\reverse inits)) g!meta (gensym "g!meta")] (wrap (` [(~ g!meta) ( (~ (untemplate-list& spliced =inits)))]))) _ (do meta-monad - [=elems (monad@map meta-monad untemplate-pattern elems) + [=elems (monad\map meta-monad untemplate-pattern elems) g!meta (gensym "g!meta")] (wrap (` [(~ g!meta) ( (~ (untemplate-list =elems)))]))))]) ([#Tuple] [#Form]) @@ -5867,12 +5867,12 @@ (macro: #export (:let tokens) (case tokens (^ (list [_ (#Tuple bindings)] bodyT)) - (if (multiple? 2 (list@size bindings)) + (if (multiple? 2 (list\size bindings)) (return (list (` (..with-expansions [(~+ (|> bindings ..as-pairs - (list@map (function (_ [localT valueT]) + (list\map (function (_ [localT valueT]) (list localT (` (..as-is (~ valueT)))))) - (list@fold list@compose (list))))] + (list\fold list\compose (list))))] (~ bodyT))))) (..fail ":let requires an even number of parts")) -- cgit v1.2.3