aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library')
-rw-r--r--stdlib/source/library/lux.lux628
-rw-r--r--stdlib/source/library/lux/abstract/apply.lux20
-rw-r--r--stdlib/source/library/lux/abstract/codec.lux16
-rw-r--r--stdlib/source/library/lux/abstract/comonad.lux28
-rw-r--r--stdlib/source/library/lux/abstract/fold.lux16
-rw-r--r--stdlib/source/library/lux/abstract/mix.lux16
-rw-r--r--stdlib/source/library/lux/abstract/monad.lux44
-rw-r--r--stdlib/source/library/lux/abstract/monad/free.lux9
-rw-r--r--stdlib/source/library/lux/abstract/monad/indexed.lux30
-rw-r--r--stdlib/source/library/lux/abstract/monoid.lux4
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux30
-rw-r--r--stdlib/source/library/lux/control/concurrency/actor.lux2
-rw-r--r--stdlib/source/library/lux/control/concurrency/async.lux2
-rw-r--r--stdlib/source/library/lux/control/concurrency/frp.lux12
-rw-r--r--stdlib/source/library/lux/control/concurrency/stm.lux2
-rw-r--r--stdlib/source/library/lux/control/continuation.lux2
-rw-r--r--stdlib/source/library/lux/control/exception.lux28
-rw-r--r--stdlib/source/library/lux/control/io.lux2
-rw-r--r--stdlib/source/library/lux/control/lazy.lux2
-rw-r--r--stdlib/source/library/lux/control/maybe.lux2
-rw-r--r--stdlib/source/library/lux/control/parser.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/binary.lux2
-rw-r--r--stdlib/source/library/lux/control/parser/json.lux10
-rw-r--r--stdlib/source/library/lux/control/parser/synthesis.lux4
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux34
-rw-r--r--stdlib/source/library/lux/control/parser/tree.lux33
-rw-r--r--stdlib/source/library/lux/control/parser/type.lux6
-rw-r--r--stdlib/source/library/lux/control/parser/xml.lux2
-rw-r--r--stdlib/source/library/lux/control/pipe.lux3
-rw-r--r--stdlib/source/library/lux/control/reader.lux2
-rw-r--r--stdlib/source/library/lux/control/region.lux6
-rw-r--r--stdlib/source/library/lux/control/remember.lux9
-rw-r--r--stdlib/source/library/lux/control/security/policy.lux2
-rw-r--r--stdlib/source/library/lux/control/state.lux4
-rw-r--r--stdlib/source/library/lux/control/thread.lux2
-rw-r--r--stdlib/source/library/lux/control/try.lux4
-rw-r--r--stdlib/source/library/lux/control/writer.lux4
-rw-r--r--stdlib/source/library/lux/data/bit.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux132
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary.lux158
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux14
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux79
-rw-r--r--stdlib/source/library/lux/data/collection/row.lux62
-rw-r--r--stdlib/source/library/lux/data/collection/set.lux8
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux40
-rw-r--r--stdlib/source/library/lux/data/collection/set/ordered.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/tree.lux18
-rw-r--r--stdlib/source/library/lux/data/collection/tree/zipper.lux2
-rw-r--r--stdlib/source/library/lux/data/color.lux13
-rw-r--r--stdlib/source/library/lux/data/color/named.lux1
-rw-r--r--stdlib/source/library/lux/data/format/binary.lux4
-rw-r--r--stdlib/source/library/lux/data/format/css.lux4
-rw-r--r--stdlib/source/library/lux/data/format/html.lux10
-rw-r--r--stdlib/source/library/lux/data/format/json.lux42
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux54
-rw-r--r--stdlib/source/library/lux/data/format/xml.lux8
-rw-r--r--stdlib/source/library/lux/data/identity.lux3
-rw-r--r--stdlib/source/library/lux/data/name.lux4
-rw-r--r--stdlib/source/library/lux/data/product.lux1
-rw-r--r--stdlib/source/library/lux/data/text.lux4
-rw-r--r--stdlib/source/library/lux/data/text/buffer.lux16
-rw-r--r--stdlib/source/library/lux/data/text/encoding.lux1
-rw-r--r--stdlib/source/library/lux/data/text/encoding/utf8.lux17
-rw-r--r--stdlib/source/library/lux/data/text/escape.lux4
-rw-r--r--stdlib/source/library/lux/data/text/format.lux34
-rw-r--r--stdlib/source/library/lux/data/text/regex.lux78
-rw-r--r--stdlib/source/library/lux/data/text/unicode/set.lux12
-rw-r--r--stdlib/source/library/lux/documentation.lux38
-rw-r--r--stdlib/source/library/lux/ffi.js.lux2
-rw-r--r--stdlib/source/library/lux/ffi.jvm.lux17
-rw-r--r--stdlib/source/library/lux/ffi.lua.lux12
-rw-r--r--stdlib/source/library/lux/ffi.old.lux18
-rw-r--r--stdlib/source/library/lux/ffi.php.lux2
-rw-r--r--stdlib/source/library/lux/ffi.py.lux12
-rw-r--r--stdlib/source/library/lux/ffi.rb.lux2
-rw-r--r--stdlib/source/library/lux/ffi.scm.lux2
-rw-r--r--stdlib/source/library/lux/macro.lux6
-rw-r--r--stdlib/source/library/lux/macro/code.lux35
-rw-r--r--stdlib/source/library/lux/macro/template.lux15
-rw-r--r--stdlib/source/library/lux/math.lux69
-rw-r--r--stdlib/source/library/lux/math/infix.lux22
-rw-r--r--stdlib/source/library/lux/math/modular.lux18
-rw-r--r--stdlib/source/library/lux/math/modulus.lux8
-rw-r--r--stdlib/source/library/lux/math/number.lux39
-rw-r--r--stdlib/source/library/lux/math/number/complex.lux7
-rw-r--r--stdlib/source/library/lux/math/number/frac.lux112
-rw-r--r--stdlib/source/library/lux/math/number/i16.lux3
-rw-r--r--stdlib/source/library/lux/math/number/i32.lux3
-rw-r--r--stdlib/source/library/lux/math/number/i64.lux43
-rw-r--r--stdlib/source/library/lux/math/number/i8.lux3
-rw-r--r--stdlib/source/library/lux/math/number/int.lux47
-rw-r--r--stdlib/source/library/lux/math/number/nat.lux34
-rw-r--r--stdlib/source/library/lux/math/number/ratio.lux16
-rw-r--r--stdlib/source/library/lux/math/number/rev.lux43
-rw-r--r--stdlib/source/library/lux/math/random.lux21
-rw-r--r--stdlib/source/library/lux/meta.lux56
-rw-r--r--stdlib/source/library/lux/meta/annotation.lux1
-rw-r--r--stdlib/source/library/lux/meta/location.lux12
-rw-r--r--stdlib/source/library/lux/target.lux2
-rw-r--r--stdlib/source/library/lux/target/common_lisp.lux2
-rw-r--r--stdlib/source/library/lux/target/js.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/attribute/code.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode.lux8
-rw-r--r--stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/class.lux12
-rw-r--r--stdlib/source/library/lux/target/jvm/constant/pool.lux10
-rw-r--r--stdlib/source/library/lux/target/jvm/reflection.lux8
-rw-r--r--stdlib/source/library/lux/target/lua.lux12
-rw-r--r--stdlib/source/library/lux/target/php.lux12
-rw-r--r--stdlib/source/library/lux/target/python.lux10
-rw-r--r--stdlib/source/library/lux/target/r.lux10
-rw-r--r--stdlib/source/library/lux/target/ruby.lux10
-rw-r--r--stdlib/source/library/lux/target/scheme.lux2
-rw-r--r--stdlib/source/library/lux/test.lux24
-rw-r--r--stdlib/source/library/lux/time.lux24
-rw-r--r--stdlib/source/library/lux/time/date.lux34
-rw-r--r--stdlib/source/library/lux/time/day.lux10
-rw-r--r--stdlib/source/library/lux/time/duration.lux18
-rw-r--r--stdlib/source/library/lux/time/instant.lux8
-rw-r--r--stdlib/source/library/lux/time/month.lux10
-rw-r--r--stdlib/source/library/lux/time/year.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/default/platform.lux42
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux52
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux8
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux82
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux20
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux20
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux108
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux20
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux45
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux56
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux34
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux16
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive.lux28
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux36
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux24
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/archive.lux62
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/io/context.lux40
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux22
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux32
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/script.lux30
-rw-r--r--stdlib/source/library/lux/type.lux36
-rw-r--r--stdlib/source/library/lux/type/abstract.lux6
-rw-r--r--stdlib/source/library/lux/type/check.lux20
-rw-r--r--stdlib/source/library/lux/type/implicit.lux38
-rw-r--r--stdlib/source/library/lux/type/poly.lux2
-rw-r--r--stdlib/source/library/lux/type/resource.lux18
-rw-r--r--stdlib/source/library/lux/world/file/watch.lux92
-rw-r--r--stdlib/source/library/lux/world/net/http/request.lux26
-rw-r--r--stdlib/source/library/lux/world/net/http/response.lux8
-rw-r--r--stdlib/source/library/lux/world/shell.lux32
196 files changed, 2095 insertions, 2281 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 986378ad7..ffe7daf46 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1143,7 +1143,7 @@
(#Function Nat Code)
(form$ (#Item (tag$ ["library/lux" "Parameter"]) (#Item (nat$ idx) #End))))
-(def:'' .private (list\fold f init xs)
+(def:'' .private (list\mix f init xs)
#End
... (All [a b] (-> (-> b a a) a (List b) a))
(#UnivQ #End (#UnivQ #End (#Function (#Function (#Parameter 1)
@@ -1156,14 +1156,14 @@
init
(#Item x xs')
- (list\fold f (f x init) xs')}
+ (list\mix f (f x init) xs')}
xs))
(def:'' .private (list\size list)
#End
(#UnivQ #End
(#Function ($' List (#Parameter 1)) Nat))
- (list\fold (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list))
+ (list\mix (function'' [_ acc] ("lux i64 +" 1 acc)) 0 list))
(macro:' .public (All tokens)
(#Item [(tag$ ["library/lux" "doc"])
@@ -1184,15 +1184,15 @@
({(#Item [_ (#Tuple args)] (#Item body #End))
(quantified_args_parser args
(function'' [names]
- (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code))
- (function'' [name' body']
- (form$ (#Item (tag$ ["library/lux" "UnivQ"])
- (#Item (tag$ ["library/lux" "End"])
- (#Item (with_replacements (#Item [name' (type_parameter 1)] #End)
- (nested_quantification body'))
- #End))))))
- body
- names)
+ (let'' body' (list\mix ("lux type check" (#Function Text (#Function Code Code))
+ (function'' [name' body']
+ (form$ (#Item (tag$ ["library/lux" "UnivQ"])
+ (#Item (tag$ ["library/lux" "End"])
+ (#Item (with_replacements (#Item [name' (type_parameter 1)] #End)
+ (nested_quantification body'))
+ #End))))))
+ body
+ names)
(in_meta (#Item ({[#1 _]
body'
@@ -1229,15 +1229,15 @@
({(#Item [_ (#Tuple args)] (#Item body #End))
(quantified_args_parser args
(function'' [names]
- (let'' body' (list\fold ("lux type check" (#Function Text (#Function Code Code))
- (function'' [name' body']
- (form$ (#Item (tag$ ["library/lux" "ExQ"])
- (#Item (tag$ ["library/lux" "End"])
- (#Item (with_replacements (#Item [name' (type_parameter 1)] #End)
- (nested_quantification body'))
- #End))))))
- body
- names)
+ (let'' body' (list\mix ("lux type check" (#Function Text (#Function Code Code))
+ (function'' [name' body']
+ (form$ (#Item (tag$ ["library/lux" "ExQ"])
+ (#Item (tag$ ["library/lux" "End"])
+ (#Item (with_replacements (#Item [name' (type_parameter 1)] #End)
+ (nested_quantification body'))
+ #End))))))
+ body
+ names)
(in_meta (#Item ({[#1 _]
body'
@@ -1258,10 +1258,10 @@
(def:'' .private (list\reversed list)
#End
(All [a] (#Function ($' List a) ($' List a)))
- (list\fold ("lux type check" (All [a] (#Function a (#Function ($' List a) ($' List a))))
- (function'' [head tail] (#Item head tail)))
- #End
- list))
+ (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 [(tag$ ["library/lux" "doc"])
@@ -1272,10 +1272,10 @@
"... This is the type of a function that takes 2 Ints and returns an Int.")))]
#End)
({(#Item output inputs)
- (in_meta (#Item (list\fold ("lux type check" (#Function Code (#Function Code Code))
- (function'' [i o] (form$ (#Item (tag$ ["library/lux" "Function"]) (#Item i (#Item o #End))))))
- output
- inputs)
+ (in_meta (#Item (list\mix ("lux type check" (#Function Code (#Function Code Code))
+ (function'' [i o] (form$ (#Item (tag$ ["library/lux" "Function"]) (#Item i (#Item o #End))))))
+ output
+ inputs)
#End))
_
@@ -1288,12 +1288,12 @@
("lux text concat" "... List-construction macro." __paragraph)
"(list +1 +2 +3)"))]
#End)
- (in_meta (#Item (list\fold (function'' [head tail]
- (form$ (#Item (tag$ ["library/lux" "Item"])
- (#Item (tuple$ (#Item [head (#Item [tail #End])]))
- #End))))
- (tag$ ["library/lux" "End"])
- (list\reversed xs))
+ (in_meta (#Item (list\mix (function'' [head tail]
+ (form$ (#Item (tag$ ["library/lux" "Item"])
+ (#Item (tuple$ (#Item [head (#Item [tail #End])]))
+ #End))))
+ (tag$ ["library/lux" "End"])
+ (list\reversed xs))
#End)))
(macro:' .public (list& xs)
@@ -1305,11 +1305,11 @@
"(list& +1 +2 +3 (list +4 +5 +6))")))]
#End)
({(#Item last init)
- (in_meta (list (list\fold (function'' [head tail]
- (form$ (list (tag$ ["library/lux" "Item"])
- (tuple$ (list head tail)))))
- last
- init)))
+ (in_meta (list (list\mix (function'' [head tail]
+ (form$ (list (tag$ ["library/lux" "Item"])
+ (tuple$ (list head tail)))))
+ last
+ init)))
_
(failure "Wrong syntax for list&")}
@@ -1329,9 +1329,9 @@
(in_meta (list (identifier$ ["library/lux" "Nothing"])))
(#Item last prevs)
- (in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Sum"]) left right)))
- last
- prevs)))}
+ (in_meta (list (list\mix (function'' [left right] (form$ (list (tag$ ["library/lux" "Sum"]) left right)))
+ last
+ prevs)))}
(list\reversed tokens)))
(macro:' .public (Tuple tokens)
@@ -1348,9 +1348,9 @@
(in_meta (list (identifier$ ["library/lux" "Any"])))
(#Item last prevs)
- (in_meta (list (list\fold (function'' [left right] (form$ (list (tag$ ["library/lux" "Product"]) left right)))
- last
- prevs)))}
+ (in_meta (list (list\mix (function'' [left right] (form$ (list (tag$ ["library/lux" "Product"]) left right)))
+ last
+ prevs)))}
(list\reversed tokens)))
(macro:' .private (function' tokens)
@@ -1367,12 +1367,12 @@
(#Item [harg targs])
(in_meta (list (form$ (list (tuple$ (list (local_identifier$ name)
harg))
- (list\fold (function'' [arg body']
- (form$ (list (tuple$ (list (local_identifier$ "")
- arg))
- body')))
- body
- (list\reversed targs))))))}
+ (list\mix (function'' [arg body']
+ (form$ (list (tuple$ (list (local_identifier$ "")
+ arg))
+ body')))
+ body
+ (list\reversed targs))))))}
args)
_
@@ -1437,14 +1437,14 @@
(macro:' .private (let' tokens)
({(#Item [[_ (#Tuple bindings)] (#Item [body #End])])
- (in_meta (list (list\fold ("lux type check" (-> (Tuple Code Code) Code
- Code)
- (function' [binding body]
- ({[label value]
- (form$ (list (record$ (list [label body])) value))}
- binding)))
- body
- (list\reversed (pairs bindings)))))
+ (in_meta (list (list\mix ("lux type check" (-> (Tuple Code Code) Code
+ Code)
+ (function' [binding body]
+ ({[label value]
+ (form$ (list (record$ (list [label body])) value))}
+ binding)))
+ body
+ (list\reversed (pairs bindings)))))
_
(failure "Wrong syntax for let'")}
@@ -1518,7 +1518,7 @@
#End)
({(#Item op tokens')
({(#Item first nexts)
- (in_meta (list (list\fold (function\flipped (right_associativity op)) first nexts)))
+ (in_meta (list (list\mix (function\flipped (right_associativity op)) first nexts)))
_
(failure "Wrong syntax for _$")}
@@ -1540,7 +1540,7 @@
#End)
({(#Item op tokens')
({(#Item last prevs)
- (in_meta (list (list\fold (right_associativity op) last prevs)))
+ (in_meta (list (list\mix (right_associativity op) last prevs)))
_
(failure "Wrong syntax for $_")}
@@ -1554,7 +1554,7 @@
... (: (All [a] (-> a (m a)))
... in)
... (: (All [a b] (-> (-> a (m b)) (m a) (m b)))
-... bind))
+... then))
("lux def type tagged" Monad
(#Named ["library/lux" "Monad"]
(All [m]
@@ -1563,7 +1563,7 @@
($' m a)
($' m b))))))
(record$ (list))
- ["in" "bind"]
+ ["in" "then"]
#0)
(def:''' .private maybe_monad
@@ -1572,7 +1572,7 @@
{#in
(function' [x] (#Some x))
- #bind
+ #then
(function' [f ma]
({#None #None
(#Some a) (f a)}
@@ -1586,7 +1586,7 @@
(function' [state]
(#Right state x)))
- #bind
+ #then
(function' [f ma]
(function' [state]
({(#Left msg)
@@ -1599,29 +1599,29 @@
(macro:' .private (do tokens)
({(#Item monad (#Item [_ (#Tuple bindings)] (#Item body #End)))
(let' [g!in (local_identifier$ "in")
- g!bind (local_identifier$ " bind ")
- body' (list\fold ("lux type check" (-> (Tuple Code Code) Code Code)
- (function' [binding body']
- (let' [[var value] binding]
- ({[_ (#Identifier [module short])]
- ({""
- (form$ (list g!bind
- (form$ (list (tuple$ (list (local_identifier$ "") var)) body'))
- value))
-
- _
- (form$ (list var value body'))}
- module)
-
-
- _
- (form$ (list g!bind
- (form$ (list (tuple$ (list (local_identifier$ "") var)) body'))
- value))}
- var))))
- body
- (list\reversed (pairs bindings)))]
- (in_meta (list (form$ (list (record$ (list [(record$ (list [(tag$ ["library/lux" "in"]) g!in] [(tag$ ["library/lux" "bind"]) g!bind]))
+ g!then (local_identifier$ " then ")
+ body' (list\mix ("lux type check" (-> (Tuple Code Code) Code Code)
+ (function' [binding body']
+ (let' [[var value] binding]
+ ({[_ (#Identifier [module short])]
+ ({""
+ (form$ (list g!then
+ (form$ (list (tuple$ (list (local_identifier$ "") var)) body'))
+ value))
+
+ _
+ (form$ (list var value body'))}
+ module)
+
+
+ _
+ (form$ (list g!then
+ (form$ (list (tuple$ (list (local_identifier$ "") var)) body'))
+ value))}
+ var))))
+ body
+ (list\reversed (pairs bindings)))]
+ (in_meta (list (form$ (list (record$ (list [(record$ (list [(tag$ ["library/lux" "in"]) g!in] [(tag$ ["library/lux" "then"]) g!then]))
body']))
monad)))))
@@ -1638,7 +1638,7 @@
(-> a ($' m b))
($' List a)
($' m ($' List b))))
- (let' [{#in in #bind _} m]
+ (let' [{#in in #then _} m]
({#End
(in #End)
@@ -1649,7 +1649,7 @@
(in (#Item y ys)))}
xs)))
-(def:''' .private (monad\fold m f y xs)
+(def:''' .private (monad\mix m f y xs)
#End
... (All [m a b]
... (-> (Monad m) (-> a b (m b)) b (List a) (m b)))
@@ -1659,14 +1659,14 @@
b
($' List a)
($' m b)))
- (let' [{#in in #bind _} m]
+ (let' [{#in in #then _} m]
({#End
(in y)
(#Item x xs')
(do m
[y' (f x y)]
- (monad\fold m f y' xs'))}
+ (monad\mix m f y' xs'))}
xs)))
(macro:' .public (if tokens)
@@ -1707,7 +1707,7 @@
(-> Text Text Text)
("lux text concat" x y))
-(def:''' .private (name\encode full_name)
+(def:''' .private (name\encoded full_name)
#End
(-> Name Text)
(let' [[module name] full_name]
@@ -1733,11 +1733,11 @@
constant)
#None
- (#Left ($_ text\compose "Unknown definition: " (name\encode full_name)))}
+ (#Left ($_ text\compose "Unknown definition: " (name\encoded full_name)))}
(plist\value name definitions))
#None
- (#Left ($_ text\compose "Unknown module: " module " @ " (name\encode full_name)))}
+ (#Left ($_ text\compose "Unknown module: " module " @ " (name\encoded full_name)))}
(plist\value module modules))))
(def:''' .private (code_list expression)
@@ -1766,21 +1766,21 @@
(in (code_list (form$ (list (tag$ ["library/lux" "Item"])
(tuple$ (list lastO (tag$ ["library/lux" "End"]))))))))}
lastI)]
- (monad\fold meta_monad
- (function' [leftI rightO]
- ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))]
- (let' [g!in-module (form$ (list (text$ "lux in-module")
- (text$ "library/lux")
- (identifier$ ["library/lux" "list\compose"])))]
- (in (form$ (list g!in-module (code_list spliced) rightO))))
-
- _
- (do meta_monad
- [leftO (untemplated leftI)]
- (in (form$ (list (tag$ ["library/lux" "Item"]) (tuple$ (list leftO rightO))))))}
- leftI))
- lastO
- inits))}
+ (monad\mix meta_monad
+ (function' [leftI rightO]
+ ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))]
+ (let' [g!in-module (form$ (list (text$ "lux in-module")
+ (text$ "library/lux")
+ (identifier$ ["library/lux" "list\compose"])))]
+ (in (form$ (list g!in-module (code_list spliced) rightO))))
+
+ _
+ (do meta_monad
+ [leftO (untemplated leftI)]
+ (in (form$ (list (tag$ ["library/lux" "Item"]) (tuple$ (list leftO rightO))))))}
+ leftI))
+ lastO
+ inits))}
(list\reversed elems))
#0
(do meta_monad
@@ -1965,23 +1965,23 @@
(list [(tag$ ["library/lux" "doc"])
(text$ ($_ "lux text concat"
"... Piping macro." __paragraph
- "(|> elems (list\map int\encode) (interposed '' '') (fold text\compose ''''))" __paragraph
+ "(|> elems (list\map int\encoded) (interposed '' '') (mix text\compose ''''))" __paragraph
"... =>" __paragraph
- "(fold text\compose '''' (interposed '' '' (list\map int\encode elems)))"))])
+ "(mix text\compose '''' (interposed '' '' (list\map int\encoded elems)))"))])
({(#Item [init apps])
- (in_meta (list (list\fold ("lux type check" (-> Code Code Code)
- (function' [app acc]
- ({[_ (#Tuple parts)]
- (tuple$ (list\compose parts (list acc)))
+ (in_meta (list (list\mix ("lux type check" (-> Code Code Code)
+ (function' [app acc]
+ ({[_ (#Tuple parts)]
+ (tuple$ (list\compose parts (list acc)))
- [_ (#Form parts)]
- (form$ (list\compose parts (list acc)))
+ [_ (#Form parts)]
+ (form$ (list\compose parts (list acc)))
- _
- (` ((~ app) (~ acc)))}
- app)))
- init
- apps)))
+ _
+ (` ((~ app) (~ acc)))}
+ app)))
+ init
+ apps)))
_
(failure "Wrong syntax for |>")}
@@ -1991,23 +1991,23 @@
(list [(tag$ ["library/lux" "doc"])
(text$ ($_ "lux text concat"
"... Reverse piping macro." __paragraph
- "(<| (fold text\compose '''') (interposed '' '') (list\map int\encode) elems)" __paragraph
+ "(<| (mix text\compose '''') (interposed '' '') (list\map int\encoded) elems)" __paragraph
"... =>" __paragraph
- "(fold text\compose '''' (interposed '' '' (list\map int\encode elems)))"))])
+ "(mix text\compose '''' (interposed '' '' (list\map int\encoded elems)))"))])
({(#Item [init apps])
- (in_meta (list (list\fold ("lux type check" (-> Code Code Code)
- (function' [app acc]
- ({[_ (#Tuple parts)]
- (tuple$ (list\compose parts (list acc)))
+ (in_meta (list (list\mix ("lux type check" (-> Code Code Code)
+ (function' [app acc]
+ ({[_ (#Tuple parts)]
+ (tuple$ (list\compose parts (list acc)))
- [_ (#Form parts)]
- (form$ (list\compose parts (list acc)))
+ [_ (#Form parts)]
+ (form$ (list\compose parts (list acc)))
- _
- (` ((~ app) (~ acc)))}
- app)))
- init
- apps)))
+ _
+ (` ((~ app) (~ acc)))}
+ app)))
+ init
+ apps)))
_
(failure "Wrong syntax for <|")}
@@ -2092,7 +2092,7 @@
#End
(All [a]
(-> (-> a Bit) ($' List a) Bit))
- (list\fold (function' [_2 _1] (if _1 (p _2) #0)) #1 xs))
+ (list\mix (function' [_2 _1] (if _1 (p _2) #0)) #1 xs))
(def:''' .private (high_bits value)
(list)
@@ -2133,7 +2133,7 @@
#End
(All [a]
(-> ($' List ($' List a)) ($' List a)))
- (list\fold list\compose #End (list\reversed xs)))
+ (list\mix list\compose #End (list\reversed xs)))
(macro:' .public (template tokens)
(list [(tag$ ["library/lux" "doc"])
@@ -2199,7 +2199,7 @@
left
right))
-(def:''' .private (bit\encode x)
+(def:''' .private (bit\encoded x)
#End
(-> Bit Text)
(if x "#1" "#0"))
@@ -2214,7 +2214,7 @@
_ ("lux io error" "@digit::format Undefined behavior.")}
digit))
-(def:''' .private (nat\encode value)
+(def:''' .private (nat\encoded value)
#End
(-> Nat Text)
({0
@@ -2238,7 +2238,7 @@
("lux i64 *" -1 value)
value))
-(def:''' .private (int\encode value)
+(def:''' .private (int\encoded value)
#End
(-> Int Text)
(if ("lux i64 =" +0 value)
@@ -2256,7 +2256,7 @@
(|> value ("lux i64 /" +10) int\abs)
(|> value ("lux i64 %" +10) int\abs ("lux type as" Nat) digit::format)))))
-(def:''' .private (frac\encode x)
+(def:''' .private (frac\encoded x)
#End
(-> Frac Text)
("lux f64 encode" x))
@@ -2465,10 +2465,10 @@
expression
[_ (#Form (#Item type_fn args))]
- (list\fold ("lux type check" (-> Code Code Code)
- (function' [arg type_fn] (` (#.Apply (~ arg) (~ type_fn)))))
- (normal_type type_fn)
- (list\map normal_type args))
+ (list\mix ("lux type check" (-> Code Code Code)
+ (function' [arg type_fn] (` (#.Apply (~ arg) (~ type_fn)))))
+ (normal_type type_fn)
+ (list\map normal_type args))
_
type}
@@ -2601,7 +2601,7 @@
#seed ("lux i64 +" 1 seed) #expected expected
#location location #extensions extensions
#scope_type_vars scope_type_vars #eval _eval}
- (local_identifier$ ($_ text\compose "__gensym__" prefix (nat\encode seed))))}
+ (local_identifier$ ($_ text\compose "__gensym__" prefix (nat\encoded seed))))}
state))
(macro:' .public (Rec tokens)
@@ -2631,11 +2631,11 @@
"''YOLO'')"))])
({(#Item value actions)
(let' [dummy (local_identifier$ "")]
- (in_meta (list (list\fold ("lux type check" (-> Code Code Code)
- (function' [pre post] (` ({(~ dummy) (~ post)}
- (~ pre)))))
- value
- actions))))
+ (in_meta (list (list\mix ("lux type check" (-> Code Code Code)
+ (function' [pre post] (` ({(~ dummy) (~ post)}
+ (~ pre)))))
+ value
+ actions))))
_
(failure "Wrong syntax for exec")}
@@ -2681,29 +2681,29 @@
(failure "Wrong syntax for def'")}
parts)))
-(def:' .private (text\encode original)
+(def:' .private (text\encoded original)
(-> Text Text)
($_ text\compose ..double_quote original ..double_quote))
-(def:' .private (code\encode code)
+(def:' .private (code\encoded code)
(-> Code Text)
({[_ (#Bit value)]
- (bit\encode value)
+ (bit\encoded value)
[_ (#Nat value)]
- (nat\encode value)
+ (nat\encoded value)
[_ (#Int value)]
- (int\encode value)
+ (int\encoded value)
[_ (#Rev value)]
- ("lux io error" "@code\encode Undefined behavior.")
+ ("lux io error" "@code\encoded Undefined behavior.")
[_ (#Frac value)]
- (frac\encode value)
+ (frac\encoded value)
[_ (#Text value)]
- (text\encode value)
+ (text\encoded value)
[_ (#Identifier [module name])]
(if (text\= "" module)
@@ -2717,25 +2717,25 @@
[_ (#Form xs)]
($_ text\compose "(" (|> xs
- (list\map code\encode)
+ (list\map code\encoded)
(list\interposed " ")
list\reversed
- (list\fold text\compose "")) ")")
+ (list\mix text\compose "")) ")")
[_ (#Tuple xs)]
($_ text\compose "[" (|> xs
- (list\map code\encode)
+ (list\map code\encoded)
(list\interposed " ")
list\reversed
- (list\fold text\compose "")) "]")
+ (list\mix text\compose "")) "]")
[_ (#Record kvs)]
($_ text\compose "{" (|> kvs
- (list\map (function' [kv] ({[k v] ($_ text\compose (code\encode k) " " (code\encode v))}
+ (list\map (function' [kv] ({[k v] ($_ text\compose (code\encoded k) " " (code\encoded v))}
kv)))
(list\interposed " ")
list\reversed
- (list\fold text\compose "")) "}")}
+ (list\mix text\compose "")) "}")}
code))
(def:' .private (expander branches)
@@ -2765,10 +2765,10 @@
_
(failure ($_ text\compose "'lux.case' expects an even number of tokens: " (|> branches
- (list\map code\encode)
+ (list\map code\encoded)
(list\interposed " ")
list\reversed
- (list\fold text\compose ""))))}
+ (list\mix text\compose ""))))}
branches))
(macro:' .public (case tokens)
@@ -2865,13 +2865,13 @@
(^ (list [_ (#Tuple bindings)] body))
(if (multiple? 2 (list\size bindings))
(|> bindings pairs list\reversed
- (list\fold (: (-> [Code Code] Code Code)
- (function' [lr body']
- (let' [[l r] lr]
- (if (identifier? l)
- (` ({(~ l) (~ body')} (~ r)))
- (` (case (~ r) (~ l) (~ body')))))))
- body)
+ (list\mix (: (-> [Code Code] Code Code)
+ (function' [lr body']
+ (let' [[l r] lr]
+ (if (identifier? l)
+ (` ({(~ l) (~ body')} (~ r)))
+ (` (case (~ r) (~ l) (~ body')))))))
+ body)
list
in_meta)
(failure "let requires an even number of parts"))
@@ -2906,7 +2906,7 @@
(` ([(~ g!name) (~ g!blank)]
(.case (~ g!blank) (~ arg) (~ body'))))))))]
(in_meta (list (nest (..local_identifier$ g!name) head
- (list\fold (nest g!blank) body (list\reversed tail))))))
+ (list\mix (nest g!blank) body (list\reversed tail))))))
#None
(failure "Wrong syntax for function")))
@@ -2971,13 +2971,13 @@
_
(` (#.Item [[(~ location_code) (#.Tag ["library/lux" "func_args"])]
[(~ location_code) (#.Tuple (.list (~+ (list\map (function (_ parameter)
- (` [(~ location_code) (#.Text (~ (text$ (code\encode parameter))))]))
+ (` [(~ location_code) (#.Text (~ (text$ (code\encoded parameter))))]))
parameters))))]]
(~ meta)))))
(def:' .private (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\encoded arg)))
args))]}))
(def:' .private (endP tokens)
@@ -3195,7 +3195,7 @@
(-> Code Code Code)
(case addition
[location (#Record pairs)]
- (list\fold with_definition_annotation base pairs)
+ (list\mix with_definition_annotation base pairs)
_
base))
@@ -3295,10 +3295,10 @@
{#.doc <documentation>}
(case (list\reversed tokens)
(^ (list& last init))
- (in_meta (list (list\fold (: (-> Code Code Code)
- (function (_ pre post) (` <form>)))
- last
- init)))
+ (in_meta (list (list\mix (: (-> Code Code Code)
+ (function (_ pre post) (` <form>)))
+ last
+ init)))
_
(failure <message>)))]
@@ -3508,7 +3508,7 @@
(in_meta output)
_
- (failure (text\compose "Unknown tag: " (name\encode [module name]))))))
+ (failure (text\compose "Unknown tag: " (name\encoded [module name]))))))
(def: (record_slots type)
(-> Type (Meta (Maybe [(List Name) (List Type)])))
@@ -3610,10 +3610,10 @@
""
(#Item head tail)
- (list\fold (function (_ right left)
- ($_ text\compose left separator right))
- head
- tail)))
+ (list\mix (function (_ right left)
+ ($_ text\compose left separator right))
+ head
+ tail)))
(def: (remainderP tokens)
(-> (List Code) (Maybe (List Code)))
@@ -4150,7 +4150,7 @@
[current_module current_module_name]
(failure ($_ text\compose
"Wrong syntax for import @ " current_module
- ..\n (code\encode token)))))))
+ ..\n (code\encoded token)))))))
imports)]
(in (list\joined imports'))))
@@ -4181,10 +4181,10 @@
#None
(#Left ($_ text\compose
- "Unknown module: " (text\encode module) ..\n
+ "Unknown module: " (text\encoded module) ..\n
"Current module: " (case current_module
(#Some current_module)
- (text\encode current_module)
+ (text\encoded current_module)
#None
"???") ..\n
@@ -4192,7 +4192,7 @@
(list\map (function (_ [name module])
(text$ name)))
tuple$
- code\encode))))
+ code\encoded))))
))
(def: (only p xs)
@@ -4208,11 +4208,11 @@
(def: (is_member? cases name)
(-> (List Text) Text Bit)
- (let [output (list\fold (function (_ case prev)
- (or prev
- (text\= case name)))
- #0
- cases)]
+ (let [output (list\mix (function (_ case prev)
+ (or prev
+ (text\= case name)))
+ #0
+ cases)]
output))
(def: (on_either f x1 x2)
@@ -4278,12 +4278,12 @@
#scope_type_vars scope_type_vars #eval _eval} state]
(case (plist\value v_module modules)
#None
- (#Left (text\compose "Unknown definition: " (name\encode name)))
+ (#Left (text\compose "Unknown definition: " (name\encoded name)))
(#Some {#definitions definitions #module_hash _ #module_aliases _ #imports _ #tags tags #types types #module_annotations _ #module_state _})
(case (plist\value v_name definitions)
#None
- (#Left (text\compose "Unknown definition: " (name\encode name)))
+ (#Left (text\compose "Unknown definition: " (name\encoded name)))
(#Some definition)
(case definition
@@ -4321,13 +4321,13 @@
(#Right [compiler struct_type])
_
- (#Left ($_ text\compose "Unknown var: " (name\encode full_name)))))
+ (#Left ($_ text\compose "Unknown var: " (name\encoded full_name)))))
(case (definition_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\encoded full_name)))))]
(case temp
(#Right [compiler (#Var type_id)])
(let [{#info _ #source _ #current_module _ #modules _
@@ -4360,7 +4360,7 @@
_
(list)))
-(def: (type\encode type)
+(def: (type\encoded type)
(-> Type Text)
(case type
(#Primitive name params)
@@ -4369,41 +4369,41 @@
name
_
- ($_ text\compose "(" name " " (|> params (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")"))
+ ($_ text\compose "(" name " " (|> params (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose "")) ")"))
(#Sum _)
- ($_ text\compose "(Or " (|> (flat_variant type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")")
+ ($_ text\compose "(Or " (|> (flat_variant type) (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose "")) ")")
(#Product _)
- ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) "]")
+ ($_ text\compose "[" (|> (flat_tuple type) (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose "")) "]")
(#Function _)
- ($_ text\compose "(-> " (|> (flat_lambda type) (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose "")) ")")
+ ($_ text\compose "(-> " (|> (flat_lambda type) (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose "")) ")")
(#Parameter id)
- (nat\encode id)
+ (nat\encoded id)
(#Var id)
- ($_ text\compose "⌈v:" (nat\encode id) "⌋")
+ ($_ text\compose "⌈v:" (nat\encoded id) "⌋")
(#Ex id)
- ($_ text\compose "⟨e:" (nat\encode id) "⟩")
+ ($_ text\compose "⟨e:" (nat\encoded id) "⟩")
(#UnivQ env body)
- ($_ text\compose "(All " (type\encode body) ")")
+ ($_ text\compose "(All " (type\encoded body) ")")
(#ExQ env body)
- ($_ text\compose "(Ex " (type\encode body) ")")
+ ($_ text\compose "(Ex " (type\encoded body) ")")
(#Apply _)
(let [[func args] (flat_application type)]
($_ text\compose
- "(" (type\encode func) " "
- (|> args (list\map type\encode) (list\interposed " ") list\reversed (list\fold text\compose ""))
+ "(" (type\encoded func) " "
+ (|> args (list\map type\encoded) (list\interposed " ") list\reversed (list\mix text\compose ""))
")"))
(#Named name _)
- (name\encode name)
+ (name\encoded name)
))
(macro: .public (^open tokens)
@@ -4425,7 +4425,7 @@
struct_evidence (record_slots init_type)]
(case struct_evidence
#None
- (failure (text\compose "Can only 'open' structs: " (type\encode init_type)))
+ (failure (text\compose "Can only 'open' structs: " (type\encoded init_type)))
(#Some tags&members)
(do meta_monad
@@ -4436,20 +4436,20 @@
tags)
pattern (tuple$ (list\map identifier$ locals))]
(do meta_monad
- [enhanced_target (monad\fold meta_monad
- (function (_ [m_local m_type] enhanced_target)
- (do meta_monad
- [m_implementation (record_slots m_type)]
- (case m_implementation
- (#Some m_tags&members)
- (recur m_local
- m_tags&members
- enhanced_target)
-
- #None
- (in enhanced_target))))
- target
- (zipped/2 locals members))]
+ [enhanced_target (monad\mix meta_monad
+ (function (_ [m_local m_type] enhanced_target)
+ (do meta_monad
+ [m_implementation (record_slots m_type)]
+ (case m_implementation
+ (#Some m_tags&members)
+ (recur m_local
+ m_tags&members
+ enhanced_target)
+
+ #None
+ (in enhanced_target))))
+ target
+ (zipped/2 locals members))]
(in (` ({(~ pattern) (~ enhanced_target)} (~ (identifier$ source)))))))))
name tags&members body)]
(in (list full_body)))))
@@ -4469,12 +4469,12 @@
(failure "cond requires an uneven number of arguments.")
(case (list\reversed tokens)
(^ (list& else branches'))
- (in_meta (list (list\fold (: (-> [Code Code] Code Code)
- (function (_ branch else)
- (let [[right left] branch]
- (` (if (~ left) (~ right) (~ else))))))
- else
- (pairs branches'))))
+ (in_meta (list (list\mix (: (-> [Code Code] Code Code)
+ (function (_ branch else)
+ (let [[right left] branch]
+ (` (if (~ left) (~ right) (~ else))))))
+ else
+ (pairs branches'))))
_
(failure "Wrong syntax for cond"))))
@@ -4526,11 +4526,11 @@
(failure "value@ can only use records.")))
(^ (list [_ (#Tuple slots)] record))
- (in_meta (list (list\fold (: (-> Code Code Code)
- (function (_ slot inner)
- (` (..value@ (~ slot) (~ inner)))))
- record
- slots)))
+ (in_meta (list (list\mix (: (-> Code Code Code)
+ (function (_ slot inner)
+ (` (..value@ (~ slot) (~ inner)))))
+ record
+ slots)))
(^ (list selector))
(do meta_monad
@@ -4601,7 +4601,7 @@
(in_meta (list\joined decls')))
_
- (failure (text\compose "Can only 'open:' structs: " (type\encode struct_type)))))
+ (failure (text\compose "Can only 'open:' structs: " (type\encoded struct_type)))))
_
(do meta_monad
@@ -4617,9 +4617,9 @@
(macro: .public (|>> 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." ..\n
- "(|>> (list\map int\encode) (interposed '' '') (fold text\compose ''''))" ..\n
+ "(|>> (list\map int\encoded) (interposed '' '') (mix text\compose ''''))" ..\n
"... =>" ..\n
- "(function (_ <arg>) (fold text\compose '''' (interposed '' '' (list\map int\encode <arg>))))"))}
+ "(function (_ <arg>) (mix text\compose '''' (interposed '' '' (list\map int\encoded <arg>))))"))}
(do meta_monad
[g!_ (..identifier "_")
g!arg (..identifier "arg")]
@@ -4628,9 +4628,9 @@
(macro: .public (<<| 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." ..\n
- "(<<| (fold text\compose '''') (interposed '' '') (list\map int\encode))" ..\n
+ "(<<| (mix text\compose '''') (interposed '' '') (list\map int\encoded))" ..\n
"... =>" ..\n
- "(function (_ <arg>) (fold text\compose '''' (interposed '' '' (list\map int\encode <arg>))))"))}
+ "(function (_ <arg>) (mix text\compose '''' (interposed '' '' (list\map int\encoded <arg>))))"))}
(do meta_monad
[g!_ (..identifier "_")
g!arg (..identifier "arg")]
@@ -4659,9 +4659,9 @@
_
(failure ($_ text\compose "Wrong syntax for refer @ " current_module
..\n (|> options
- (list\map code\encode)
+ (list\map code\encoded)
(list\interposed " ")
- (list\fold text\compose "")))))))
+ (list\mix text\compose "")))))))
(def: (referral_definitions module_name [r_defs r_opens])
(-> Text Refer (Meta (List Code)))
@@ -4792,10 +4792,10 @@
(macro: .public (\ tokens)
{#.doc (text$ ($_ "lux text concat"
"... Allows accessing the value of a implementation's member." ..\n
- "(\ codec encode)"
+ "(\ codec encoded)"
__paragraph
"... Also allows using that value as a function." ..\n
- "(\ codec encode +123)"))}
+ "(\ codec encoded +123)"))}
(case tokens
(^ (list struct [_ (#Identifier member)]))
(in_meta (list (` (let [(^open (~ (text$ ..self_reference))) (~ struct)] (~ (identifier$ member))))))
@@ -4862,17 +4862,17 @@
(function (_ _) (..identifier "temp")))
slots)
.let [pairs (zipped/2 slots bindings)
- update_expr (list\fold (: (-> [Code Code] Code Code)
- (function (_ [s b] v)
- (` (..with@ (~ s) (~ v) (~ b)))))
- value
- (list\reversed pairs))
- [_ accesses'] (list\fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))])
- (function (_ [new_slot new_binding] [old_record accesses'])
- [(` (value@ (~ new_slot) (~ new_binding)))
- (#Item (list new_binding old_record) accesses')]))
- [record (: (List (List Code)) #End)]
- pairs)
+ update_expr (list\mix (: (-> [Code Code] Code Code)
+ (function (_ [s b] v)
+ (` (..with@ (~ s) (~ v) (~ b)))))
+ value
+ (list\reversed pairs))
+ [_ accesses'] (list\mix (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))])
+ (function (_ [new_slot new_binding] [old_record accesses'])
+ [(` (value@ (~ new_slot) (~ new_binding)))
+ (#Item (list new_binding old_record) accesses')]))
+ [record (: (List (List Code)) #End)]
+ pairs)
accesses (list\joined (list\reversed accesses'))]]
(in (list (` (let [(~+ accesses)]
(~ update_expr)))))))
@@ -5050,14 +5050,14 @@
(^template [<tag>]
[[[_ _ column] (<tag> parts)]
- (list\fold n/min column (list\map baseline_column parts))])
+ (list\mix n/min column (list\map baseline_column parts))])
([#Form]
[#Tuple])
[[_ _ column] (#Record pairs)]
- (list\fold n/min column
- (list\compose (list\map (|>> product\left baseline_column) pairs)
- (list\map (|>> product\right baseline_column) pairs)))
+ (list\mix n/min column
+ (list\compose (list\map (|>> product\left baseline_column) pairs)
+ (list\map (|>> product\right baseline_column) pairs)))
))
(type: Documentation_Fragment
@@ -5083,9 +5083,9 @@
[-- "lux i64 -" "Decrement function."]
)
-(def: tag\encode
+(def: tag\encoded
(-> Name Text)
- (|>> name\encode (text\compose "#")))
+ (|>> name\encoded (text\compose "#")))
(def: (repeated n x)
(All [a] (-> Int a (List a)))
@@ -5120,27 +5120,27 @@
(def: (example_documentation prev_location baseline example)
(-> Location Nat Code [Location Text])
(case example
- (^template [<tag> <encode>]
+ (^template [<tag> <encoded>]
[[new_location (<tag> value)]
- (let [as_text (<encode> value)]
+ (let [as_text (<encoded> value)]
[(updated_location new_location as_text)
(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\encoded]
+ [#Nat nat\encoded]
+ [#Int int\encoded]
+ [#Frac frac\encoded]
+ [#Text text\encoded]
+ [#Identifier name\encoded]
+ [#Tag tag\encoded])
(^template [<tag> <open> <close> <prep>]
[[group_location (<tag> parts)]
- (let [[group_location' parts_text] (list\fold (function (_ part [last_location text_accum])
- (let [[part_location part_text] (example_documentation last_location baseline part)]
- [part_location (text\compose text_accum part_text)]))
- [(revised@ #column ++ group_location) ""]
- (<prep> parts))]
+ (let [[group_location' parts_text] (list\mix (function (_ part [last_location text_accum])
+ (let [[part_location part_text] (example_documentation last_location baseline part)]
+ [part_location (text\compose text_accum part_text)]))
+ [(revised@ #column ++ group_location) ""]
+ (<prep> parts))]
[(revised@ #column ++ group_location')
($_ text\compose (location_padding baseline prev_location group_location)
<open>
@@ -5374,7 +5374,7 @@
(test: "Code operations & implementations"
(with_expansions
[<tests> (template [<expr> <text>]
- [(compare <text> (\ Code/encode encode <expr>))]
+ [(compare <text> (\ codec encoded <expr>))]
[(bit #1) "#1"]
[(int +123) "+123"]
@@ -5448,7 +5448,7 @@
["Text" Text text$])
_
- (failure (text\compose "Cannot anti-quote type: " (name\encode name))))))
+ (failure (text\compose "Cannot anti-quote type: " (name\encoded name))))))
(def: (static_literal token)
(-> Code (Meta Code))
@@ -5542,22 +5542,22 @@
(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 [bind? (case pattern
- [_ (#.Identifier _)]
- #1
+ (let [inner_pattern_body (list\mix (function (_ [calculation pattern] success)
+ (let [bind? (case pattern
+ [_ (#.Identifier _)]
+ #1
- _
- #0)]
- (` (case (~ calculation)
- (~ pattern)
- (~ success)
-
- (~+ (if bind?
- (list)
- (list g!_ (` #.None))))))))
- (` (#.Some (~ body)))
- (: (List [Code Code]) (list\reversed levels)))]
+ _
+ #0)]
+ (` (case (~ calculation)
+ (~ pattern)
+ (~ success)
+
+ (~+ (if bind?
+ (list)
+ (list g!_ (` #.None))))))))
+ (` (#.Some (~ body)))
+ (: (List [Code Code]) (list\reversed levels)))]
(list init_pattern inner_pattern_body)))
(macro: .public (^multi tokens)
@@ -5617,7 +5617,7 @@
... 'wrong_syntax_error' for easier maintenance of the error_messages.
(def: wrong_syntax_error
(-> Name Text)
- (|>> name\encode
+ (|>> name\encoded
(text\compose "Wrong syntax for ")))
(macro: .public (name_of tokens)
@@ -5649,10 +5649,10 @@
"In the example below, 0 corresponds to the 'a' variable."
(def: .public (of_list list)
(All [a] (-> (List a) (Row a)))
- (list\fold add
- (: (Row (:parameter 0))
- empty)
- list)))}
+ (list\mix add
+ (: (Row (:parameter 0))
+ empty)
+ list)))}
(case tokens
(^ (list [_ (#Nat idx)]))
(do meta_monad
@@ -5662,7 +5662,7 @@
(in (list (` (#Ex (~ (nat$ var_id))))))
#None
- (failure (text\compose "Indexed-type does not exist: " (nat\encode idx)))))
+ (failure (text\compose "Indexed-type does not exist: " (nat\encoded idx)))))
_
(failure (..wrong_syntax_error (name_of ..$)))))
@@ -5681,9 +5681,9 @@
(macro: .public (^@ tokens)
{#.doc (example "Allows you to simultaneously bind and de-structure a value."
(def: (hash (^@ set [Hash<a> _]))
- (list\fold (function (_ elem acc) (+ (\ Hash<a> hash elem) acc))
- 0
- (to_list set))))}
+ (list\mix (function (_ elem acc) (+ (\ Hash<a> hash elem) acc))
+ 0
+ (to_list set))))}
(case tokens
(^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] pattern))] body branches))
(let [g!whole (local_identifier$ name)]
@@ -5742,7 +5742,7 @@
(do meta_monad
[location ..location
.let [[module line column] location
- location ($_ "lux text concat" (text\encode module) "," (nat\encode line) "," (nat\encode column))
+ location ($_ "lux text concat" (text\encoded module) "," (nat\encoded line) "," (nat\encoded column))
message ($_ "lux text concat" "Undefined behavior @ " location)]]
(in (list (` (..panic! (~ (text$ message)))))))
@@ -5897,12 +5897,12 @@
_
(failure ($_ text\compose
- "Invalid target platform (must be a value of type Text): " (name\encode identifier)
- " : " (..code\encode (..type_code type))))))
+ "Invalid target platform (must be a value of type Text): " (name\encoded identifier)
+ " : " (..code\encoded (..type_code type))))))
_
(failure ($_ text\compose
- "Invalid target platform syntax: " (..code\encode choice)
+ "Invalid target platform syntax: " (..code\encoded choice)
..\n "Must be either a text literal or an identifier."))))
(def: (target_pick target options default)
@@ -5962,7 +5962,7 @@
[[ann (<tag> parts)]
(do meta_monad
[=parts (monad\map meta_monad embedded_expansions parts)]
- (in [(list\fold list\compose (list) (list\map left =parts))
+ (in [(list\mix list\compose (list) (list\map left =parts))
[ann (<tag> (list\map right =parts))]]))])
([#Form] [#Tuple])
@@ -5977,7 +5977,7 @@
[val_labels val_labelled] =val]]
(in [(list\compose key_labels val_labels) [key_labelled val_labelled]])))
kvs)]
- (in [(list\fold list\compose (list) (list\map left =kvs))
+ (in [(list\mix list\compose (list) (list\map left =kvs))
[ann (#Record (list\map right =kvs))]]))
_
@@ -6124,7 +6124,7 @@
..pairs
(list\map (function (_ [localT valueT])
(list localT (` (..as_is (~ valueT))))))
- (list\fold list\compose (list))))]
+ (list\mix list\compose (list))))]
(~ bodyT)))))
(..failure ":let requires an even number of parts"))
diff --git a/stdlib/source/library/lux/abstract/apply.lux b/stdlib/source/library/lux/abstract/apply.lux
index 0b80263e8..7ca651988 100644
--- a/stdlib/source/library/lux/abstract/apply.lux
+++ b/stdlib/source/library/lux/abstract/apply.lux
@@ -9,8 +9,8 @@
(: (Functor f)
&functor)
(: (All [a b]
- (-> (f (-> a b)) (f a) (f b)))
- apply))
+ (-> (f a) (f (-> a b)) (f b)))
+ on))
(implementation: .public (composite f_monad f_apply g_apply)
(All [F G]
@@ -22,16 +22,16 @@
(functor.composite (value@ #&functor f_apply)
(value@ #&functor g_apply)))
- (def: (apply fgf fgx)
+ (def: (on fgx fgf)
... TODO: Switch from this version to the one below (in comments) ASAP.
- (let [fgf' (\ f_apply apply
- (\ f_monad in (\ g_apply apply))
- fgf)]
- (\ f_apply apply fgf' fgx))
- ... (let [applyF (\ f_apply apply)
- ... applyG (\ g_apply apply)]
+ (let [fgf' (\ f_apply on
+ fgf
+ (\ f_monad in (function (_ gf gx) (\ g_apply on gx gf))))]
+ (\ f_apply on fgx fgf'))
+ ... (let [applyF (\ f_apply on)
+ ... applyG (\ g_apply on)]
... ($_ applyF
- ... (\ f_monad in applyG)
... fgf
+ ... (\ f_monad in applyG)
... fgx))
))
diff --git a/stdlib/source/library/lux/abstract/codec.lux b/stdlib/source/library/lux/abstract/codec.lux
index 53c95a816..82b4ad194 100644
--- a/stdlib/source/library/lux/abstract/codec.lux
+++ b/stdlib/source/library/lux/abstract/codec.lux
@@ -9,19 +9,19 @@
(interface: .public (Codec m a)
(: (-> a m)
- encode)
+ encoded)
(: (-> m (Try a))
- decode))
+ decoded))
(implementation: .public (composite cb_codec ba_codec)
(All [a b c]
(-> (Codec c b) (Codec b a)
(Codec c a)))
- (def: encode
- (|>> (\ ba_codec encode)
- (\ cb_codec encode)))
+ (def: encoded
+ (|>> (\ ba_codec encoded)
+ (\ cb_codec encoded)))
- (def: (decode cy)
+ (def: (decoded cy)
(do try.monad
- [by (\ cb_codec decode cy)]
- (\ ba_codec decode by))))
+ [by (\ cb_codec decoded cy)]
+ (\ ba_codec decoded by))))
diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux
index 8803eed86..281dc7fc9 100644
--- a/stdlib/source/library/lux/abstract/comonad.lux
+++ b/stdlib/source/library/lux/abstract/comonad.lux
@@ -3,7 +3,7 @@
[lux #*
[data
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
[number
["n" nat]]]
@@ -41,21 +41,21 @@
g!_ (identifier "_")
g!map (identifier "map")
g!split (identifier "split")
- body' (list\fold (: (-> [Code Code] Code Code)
- (function (_ binding body')
- (with_expansions [<default> (` (|> (~ value) (~ g!split) ((~ g!map) (function ((~ g!_) (~ var)) (~ body')))))]
- (let [[var value] binding]
- (case var
- [_ (#.Identifier ["" _])]
- <default>
+ body' (list\mix (: (-> [Code Code] Code Code)
+ (function (_ binding body')
+ (with_expansions [<default> (` (|> (~ value) (~ g!split) ((~ g!map) (function ((~ g!_) (~ var)) (~ body')))))]
+ (let [[var value] binding]
+ (case var
+ [_ (#.Identifier ["" _])]
+ <default>
- [_ (#.Identifier _)]
- (` ((~ var) (~ value) (~ body')))
+ [_ (#.Identifier _)]
+ (` ((~ var) (~ value) (~ body')))
- _
- <default>)))))
- body
- (list.reversed (list.pairs bindings)))]
+ _
+ <default>)))))
+ body
+ (list.reversed (list.pairs bindings)))]
(#.Right [state (list (case ?name
(#.Some name)
(let [name [location.dummy (#.Identifier ["" name])]]
diff --git a/stdlib/source/library/lux/abstract/fold.lux b/stdlib/source/library/lux/abstract/fold.lux
deleted file mode 100644
index ba8a93381..000000000
--- a/stdlib/source/library/lux/abstract/fold.lux
+++ /dev/null
@@ -1,16 +0,0 @@
-(.module:
- [library
- [lux #*]]
- [//
- [monoid (#+ Monoid)]])
-
-(interface: .public (Fold F)
- (: (All [a b]
- (-> (-> b a a) a (F b) a))
- fold))
-
-(def: .public (with_monoid monoid fold value)
- (All [F a]
- (-> (Monoid a) (Fold F) (F a) a))
- (let [(^open "/\.") monoid]
- (fold /\compose /\identity value)))
diff --git a/stdlib/source/library/lux/abstract/mix.lux b/stdlib/source/library/lux/abstract/mix.lux
new file mode 100644
index 000000000..0788f38d0
--- /dev/null
+++ b/stdlib/source/library/lux/abstract/mix.lux
@@ -0,0 +1,16 @@
+(.module:
+ [library
+ [lux #*]]
+ [//
+ [monoid (#+ Monoid)]])
+
+(interface: .public (Mix F)
+ (: (All [a b]
+ (-> (-> b a a) a (F b) a))
+ mix))
+
+(def: .public (with_monoid monoid mix value)
+ (All [F a]
+ (-> (Monoid a) (Mix F) (F a) a))
+ (let [(^open "/\.") monoid]
+ (mix /\compose /\identity value)))
diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux
index 2d81c09e7..85159e505 100644
--- a/stdlib/source/library/lux/abstract/monad.lux
+++ b/stdlib/source/library/lux/abstract/monad.lux
@@ -6,7 +6,7 @@
[//
[functor (#+ Functor)]])
-(def: (list\fold f init xs)
+(def: (list\mix f init xs)
(All [a b]
(-> (-> b a a) a (List b) a))
(case xs
@@ -14,7 +14,7 @@
init
(#.Item x xs')
- (list\fold f (f x init) xs')))
+ (list\mix f (f x init) xs')))
(def: (list\size xs)
(All [a] (-> (List a) Nat))
@@ -30,9 +30,9 @@
(def: (reversed xs)
(All [a]
(-> (List a) (List a)))
- (list\fold (function (_ head tail) (#.Item head tail))
- #.End
- xs))
+ (list\mix (function (_ head tail) (#.Item head tail))
+ #.End
+ xs))
(def: (pairs xs)
(All [a] (-> (List a) (List [a a])))
@@ -72,21 +72,21 @@
g!_ (identifier "_")
g!map (identifier "map")
g!join (identifier "join")
- body' (list\fold (: (-> [Code Code] Code Code)
- (function (_ binding body')
- (with_expansions [<default> (` (|> (~ value) ((~ g!map) (function ((~ g!_) (~ var)) (~ body'))) (~ g!join)))]
- (let [[var value] binding]
- (case var
- [_ (#.Identifier ["" _])]
- <default>
-
- [_ (#.Identifier _)]
- (` ((~ var) (~ value) (~ body')))
-
- _
- <default>)))))
- body
- (reversed (pairs bindings)))]
+ body' (list\mix (: (-> [Code Code] Code Code)
+ (function (_ binding body')
+ (with_expansions [<default> (` (|> (~ value) ((~ g!map) (function ((~ g!_) (~ var)) (~ body'))) (~ g!join)))]
+ (let [[var value] binding]
+ (case var
+ [_ (#.Identifier ["" _])]
+ <default>
+
+ [_ (#.Identifier _)]
+ (` ((~ var) (~ value) (~ body')))
+
+ _
+ <default>)))))
+ body
+ (reversed (pairs bindings)))]
(#.Right [state (list (case ?name
(#.Some name)
(let [name [location.dummy (#.Identifier ["" name])]]
@@ -164,7 +164,7 @@
(recur xs'))))
!\join)))))
-(def: .public (fold monad f init xs)
+(def: .public (mix monad f init xs)
(All [M a b]
(-> (Monad M) (-> b a (M a)) a (List b)
(M a)))
@@ -175,4 +175,4 @@
(#.Item x xs')
(do monad
[init' (f x init)]
- (fold monad f init' xs'))))
+ (mix monad f init' xs'))))
diff --git a/stdlib/source/library/lux/abstract/monad/free.lux b/stdlib/source/library/lux/abstract/monad/free.lux
index 67aa94755..82b405ccc 100644
--- a/stdlib/source/library/lux/abstract/monad/free.lux
+++ b/stdlib/source/library/lux/abstract/monad/free.lux
@@ -24,9 +24,10 @@
(implementation: .public (apply dsl)
(All [F] (-> (Functor F) (Apply (Free F))))
- (def: &functor (..functor dsl))
+ (def: &functor
+ (..functor dsl))
- (def: (apply ef ea)
+ (def: (on ea ef)
(case [ef ea]
[(#Pure f) (#Pure a)]
(#Pure (f a))
@@ -37,9 +38,7 @@
fa))
[(#Effect ff) _]
- (#Effect (\ dsl map
- (function (_ f) (apply f ea))
- ff))
+ (#Effect (\ dsl map (on ea) ff))
)))
(implementation: .public (monad dsl)
diff --git a/stdlib/source/library/lux/abstract/monad/indexed.lux b/stdlib/source/library/lux/abstract/monad/indexed.lux
index b43ac87e8..f255f9727 100644
--- a/stdlib/source/library/lux/abstract/monad/indexed.lux
+++ b/stdlib/source/library/lux/abstract/monad/indexed.lux
@@ -6,7 +6,7 @@
["<.>" code (#+ Parser)]]]
[data
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
["." macro
[syntax (#+ syntax:)]
["." code]]]]
@@ -63,20 +63,20 @@
context (<code>.tuple (<>.some context))
expression <code>.any])
(macro.with_identifiers [g!_ g!then]
- (let [body (list\fold (function (_ context next)
- (case context
- (#Macro macro parameter)
- (` ((~ (code.identifier macro))
- (~ parameter)
- (~ next)))
-
- (#Binding [binding value])
- (` ((~ g!then)
- (.function ((~ g!_) (~ binding))
- (~ next))
- (~ value)))))
- expression
- (list.reversed context))]
+ (let [body (list\mix (function (_ context next)
+ (case context
+ (#Macro macro parameter)
+ (` ((~ (code.identifier macro))
+ (~ parameter)
+ (~ next)))
+
+ (#Binding [binding value])
+ (` ((~ g!then)
+ (.function ((~ g!_) (~ binding))
+ (~ next))
+ (~ value)))))
+ expression
+ (list.reversed context))]
(in (list (case ?name
(#.Some name)
(let [name (code.local_identifier name)]
diff --git a/stdlib/source/library/lux/abstract/monoid.lux b/stdlib/source/library/lux/abstract/monoid.lux
index fac4862ae..01dacde2e 100644
--- a/stdlib/source/library/lux/abstract/monoid.lux
+++ b/stdlib/source/library/lux/abstract/monoid.lux
@@ -1,6 +1,6 @@
(.module:
[library
- [lux #*]])
+ [lux (#- and)]])
(interface: .public (Monoid a)
(: a
@@ -8,7 +8,7 @@
(: (-> a a a)
compose))
-(def: .public (composite left right)
+(def: .public (and left right)
(All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r])))
(implementation
(def: identity
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 93a99ceb2..de474236a 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold functor)]]]
+ ["." list ("#\." mix functor)]]]
["." macro (#+ with_identifiers)
["." code]
["." template]
@@ -51,12 +51,12 @@
(<>.and (|> bottom^ (<>\map (|>> #.Some)))
(<>\in (list)))))
-(def: (stack_fold tops bottom)
+(def: (stack_mix tops bottom)
(-> (List Code) Code Code)
- (list\fold (function (_ top bottom)
- (` [(~ bottom) (~ top)]))
- bottom
- tops))
+ (list\mix (function (_ top bottom)
+ (` [(~ bottom) (~ top)]))
+ bottom
+ tops))
(def: (singleton expander)
(-> (Meta (List Code)) (Meta Code))
@@ -74,24 +74,24 @@
inputs stack^
outputs stack^])
(let [de_alias (function (_ aliased)
- (list\fold (function (_ [from to] pre)
- (code.replaced (code.local_identifier from) to pre))
- aliased
- aliases))]
+ (list\mix (function (_ [from to] pre)
+ (code.replaced (code.local_identifier from) to pre))
+ aliased
+ aliases))]
(case [(|> inputs (value@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))
(|> outputs (value@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))]
[(#.Some bottomI) (#.Some bottomO)]
(monad.do meta.monad
- [inputC (singleton (macro.full_expansion (stack_fold (value@ #top inputs) bottomI)))
- outputC (singleton (macro.full_expansion (stack_fold (value@ #top outputs) bottomO)))]
+ [inputC (singleton (macro.full_expansion (stack_mix (value@ #top inputs) bottomI)))
+ outputC (singleton (macro.full_expansion (stack_mix (value@ #top outputs) bottomO)))]
(in (list (` (-> (~ (de_alias inputC))
(~ (de_alias outputC)))))))
[?bottomI ?bottomO]
(with_identifiers [g!stack]
(monad.do meta.monad
- [inputC (singleton (macro.full_expansion (stack_fold (value@ #top inputs) (maybe.else g!stack ?bottomI))))
- outputC (singleton (macro.full_expansion (stack_fold (value@ #top outputs) (maybe.else g!stack ?bottomO))))]
+ [inputC (singleton (macro.full_expansion (stack_mix (value@ #top inputs) (maybe.else g!stack ?bottomI))))
+ outputC (singleton (macro.full_expansion (stack_mix (value@ #top outputs) (maybe.else g!stack ?bottomO))))]
(in (list (` (All [(~ g!stack)]
(-> (~ (de_alias inputC))
(~ (de_alias outputC))))))))))))
@@ -135,7 +135,7 @@
(-> (-> (~+ g!inputs) (~ g!output))
(=> [(~+ g!inputs)] [(~ g!output)])))
(function ((~ g!) (~ g!func))
- (function ((~ g!) (~ (stack_fold g!inputs g!stack)))
+ (function ((~ g!) (~ (stack_mix g!inputs g!stack)))
[(~ g!stack) ((~ g!func) (~+ g!inputs))])))))))))
(template [<arity>]
diff --git a/stdlib/source/library/lux/control/concurrency/actor.lux b/stdlib/source/library/lux/control/concurrency/actor.lux
index 20ab00c06..0e248ff9b 100644
--- a/stdlib/source/library/lux/control/concurrency/actor.lux
+++ b/stdlib/source/library/lux/control/concurrency/actor.lux
@@ -18,7 +18,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." monoid monad fold)]]]
+ ["." list ("#\." monoid monad)]]]
["." macro (#+ with_identifiers)
["." code]
[syntax (#+ syntax:)
diff --git a/stdlib/source/library/lux/control/concurrency/async.lux b/stdlib/source/library/lux/control/concurrency/async.lux
index 58fbb4ea6..bdd852ffc 100644
--- a/stdlib/source/library/lux/control/concurrency/async.lux
+++ b/stdlib/source/library/lux/control/concurrency/async.lux
@@ -104,7 +104,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(let [[fb resolve] (..async [])]
(exec
(io.run! (..upon! (function (_ f)
diff --git a/stdlib/source/library/lux/control/concurrency/frp.lux b/stdlib/source/library/lux/control/concurrency/frp.lux
index cb3645138..1e447ef17 100644
--- a/stdlib/source/library/lux/control/concurrency/frp.lux
+++ b/stdlib/source/library/lux/control/concurrency/frp.lux
@@ -96,13 +96,13 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(do async.monad
[item_f ff
item_a fa]
(case [item_f item_a]
[(#.Some [head_f tail_f]) (#.Some [head_a tail_a])]
- (in (#.Some [(head_f head_a) (apply tail_f tail_a)]))
+ (in (#.Some [(head_f head_a) (on tail_a tail_f)]))
_
(in #.None)))))
@@ -189,7 +189,7 @@
(#.Some [value ..empty]))
async))
-(def: .public (aggregate f init channel)
+(def: .public (mix f init channel)
(All [a b]
(-> (-> b a (Async a)) a (Channel b)
(Async a)))
@@ -202,9 +202,9 @@
(#.Some [head tail])
(do !
[init' (f head init)]
- (aggregate f init' tail)))))
+ (mix f init' tail)))))
-(def: .public (aggregates f init channel)
+(def: .public (mixes f init channel)
(All [a b]
(-> (-> b a (Async a)) a (Channel b)
(Channel a)))
@@ -217,7 +217,7 @@
(#.Some [head tail])
(do !
[init' (f head init)]
- (in (#.Some [init (aggregates f init' tail)]))))))
+ (in (#.Some [init (mixes f init' tail)]))))))
(def: .public (poll milli_seconds action)
(All [a]
diff --git a/stdlib/source/library/lux/control/concurrency/stm.lux b/stdlib/source/library/lux/control/concurrency/stm.lux
index a41d12aba..5e9759bdb 100644
--- a/stdlib/source/library/lux/control/concurrency/stm.lux
+++ b/stdlib/source/library/lux/control/concurrency/stm.lux
@@ -151,7 +151,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ tx)
(let [[tx' f] (ff tx)
[tx'' a] (fa tx')]
diff --git a/stdlib/source/library/lux/control/continuation.lux b/stdlib/source/library/lux/control/continuation.lux
index 9a65c9d3e..15fdc16d1 100644
--- a/stdlib/source/library/lux/control/continuation.lux
+++ b/stdlib/source/library/lux/control/continuation.lux
@@ -63,7 +63,7 @@
(def: &functor ..functor)
- (def: (apply ff fv)
+ (def: (on fv ff)
(function (_ k)
(|> (k (f v))
(function (_ v)) fv
diff --git a/stdlib/source/library/lux/control/exception.lux b/stdlib/source/library/lux/control/exception.lux
index d957188ea..c59767584 100644
--- a/stdlib/source/library/lux/control/exception.lux
+++ b/stdlib/source/library/lux/control/exception.lux
@@ -13,7 +13,7 @@
["." product]
["." text ("#\." monoid)]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
["." code]
[syntax (#+ syntax:)
@@ -108,10 +108,10 @@
(def: (report' entries)
(-> (List [Text Text]) Text)
(let [header_separator ": "
- largest_header_size (list\fold (function (_ [header _] max)
- (n.max (text.size header) max))
- 0
- entries)
+ largest_header_size (list\mix (function (_ [header _] max)
+ (n.max (text.size header) max))
+ 0
+ entries)
on_new_line (|> " "
(list.repeated (n.+ (text.size header_separator)
largest_header_size))
@@ -131,10 +131,10 @@
""
(#.Item head tail)
- (list\fold (function (_ post pre)
- ($_ text\compose pre text.new_line (on_entry post)))
- (on_entry head)
- tail))))
+ (list\mix (function (_ post pre)
+ ($_ text\compose pre text.new_line (on_entry post)))
+ (on_entry head)
+ tail))))
(syntax: .public (report [entries (<>.many (<code>.tuple (<>.and <code>.any <code>.any)))])
(in (list (` ((~! report') (list (~+ (|> entries
@@ -145,11 +145,11 @@
(All [a]
(-> (-> a Text) (List a) Text))
(|> entries
- (list\fold (function (_ entry [index next])
- [(++ index)
- (#.Item [(n\encode index) (format entry)]
- next)])
- [0 #.End])
+ (list\mix (function (_ entry [index next])
+ [(++ index)
+ (#.Item [(n\encoded index) (format entry)]
+ next)])
+ [0 #.End])
product.right
list.reversed
..report'))
diff --git a/stdlib/source/library/lux/control/io.lux b/stdlib/source/library/lux/control/io.lux
index 125ebfb67..4666dfb8a 100644
--- a/stdlib/source/library/lux/control/io.lux
+++ b/stdlib/source/library/lux/control/io.lux
@@ -52,7 +52,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(!io ((run!' ff) (run!' fa)))))
(implementation: .public monad
diff --git a/stdlib/source/library/lux/control/lazy.lux b/stdlib/source/library/lux/control/lazy.lux
index 46901a3c1..58cf7a526 100644
--- a/stdlib/source/library/lux/control/lazy.lux
+++ b/stdlib/source/library/lux/control/lazy.lux
@@ -61,7 +61,7 @@
(Apply Lazy)
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(lazy ((value ff) (value fa)))))
(implementation: .public monad
diff --git a/stdlib/source/library/lux/control/maybe.lux b/stdlib/source/library/lux/control/maybe.lux
index 7dcf84574..854ef0402 100644
--- a/stdlib/source/library/lux/control/maybe.lux
+++ b/stdlib/source/library/lux/control/maybe.lux
@@ -41,7 +41,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(case [ff fa]
[(#.Some f) (#.Some a)]
(#.Some (f a))
diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux
index 6d3246295..30c728cd2 100644
--- a/stdlib/source/library/lux/control/parser.lux
+++ b/stdlib/source/library/lux/control/parser.lux
@@ -36,7 +36,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ input)
(case (ff input)
(#try.Success [input' f])
@@ -301,7 +301,7 @@
(#try.Failure error)
(#try.Success [input' to_decode])
- (case (\ codec decode to_decode)
+ (case (\ codec decoded to_decode)
(#try.Failure error)
(#try.Failure error)
diff --git a/stdlib/source/library/lux/control/parser/binary.lux b/stdlib/source/library/lux/control/parser/binary.lux
index ec251b304..4fd9d15f5 100644
--- a/stdlib/source/library/lux/control/parser/binary.lux
+++ b/stdlib/source/library/lux/control/parser/binary.lux
@@ -173,7 +173,7 @@
(Parser Text)
(do //.monad
[utf8 <binary>]
- (//.lifted (\ utf8.codec decode utf8)))))]
+ (//.lifted (\ utf8.codec decoded utf8)))))]
[08 utf8/8 ..binary/8]
[16 utf8/16 ..binary/16]
diff --git a/stdlib/source/library/lux/control/parser/json.lux b/stdlib/source/library/lux/control/parser/json.lux
index cc954fc1b..1348b92b4 100644
--- a/stdlib/source/library/lux/control/parser/json.lux
+++ b/stdlib/source/library/lux/control/parser/json.lux
@@ -82,9 +82,8 @@
["Reference" (/.format reference)]
["Sample" (/.format sample)]))
-(template [<test> <check> <type> <equivalence> <tag> <desc>]
+(template [<test> <check> <type> <equivalence> <tag>]
[(def: .public (<test> test)
- {#.doc (code.text ($_ text\compose "Asks whether a JSON value is a " <desc> "."))}
(-> <type> (Parser Bit))
(do //.monad
[head ..any]
@@ -96,7 +95,6 @@
(//.failure (exception.error ..unexpected_value [head])))))
(def: .public (<check> test)
- {#.doc (code.text ($_ text\compose "Ensures a JSON value is a " <desc> "."))}
(-> <type> (Parser Any))
(do //.monad
[head ..any]
@@ -109,9 +107,9 @@
_
(//.failure (exception.error ..unexpected_value [head])))))]
- [boolean? boolean! /.Boolean bit.equivalence #/.Boolean "boolean"]
- [number? number! /.Number frac.equivalence #/.Number "number"]
- [string? string! /.String text.equivalence #/.String "string"]
+ [boolean? boolean! /.Boolean bit.equivalence #/.Boolean]
+ [number? number! /.Number frac.equivalence #/.Number]
+ [string? string! /.String text.equivalence #/.String]
)
(def: .public (nullable parser)
diff --git a/stdlib/source/library/lux/control/parser/synthesis.lux b/stdlib/source/library/lux/control/parser/synthesis.lux
index b336a0d58..df28b3df1 100644
--- a/stdlib/source/library/lux/control/parser/synthesis.lux
+++ b/stdlib/source/library/lux/control/parser/synthesis.lux
@@ -11,8 +11,6 @@
["." name]
["." text
["%" format (#+ format)]]]
- [macro
- ["." template]]
[math
[number
["n" nat]
@@ -89,7 +87,6 @@
(template [<query> <assertion> <tag> <type> <eq>]
[(`` (def: .public <query>
- {#.doc (example (~~ (template.text ["Queries for a " <query> " synthesis node."])))}
(Parser <type>)
(.function (_ input)
(case input
@@ -100,7 +97,6 @@
(exception.except ..cannot_parse input)))))
(`` (def: .public (<assertion> expected)
- {#.doc (example (~~ (template.text ["Checks for a specific " <query> " synthesis node."])))}
(-> <type> (Parser Any))
(.function (_ input)
(case input
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index a9f69d81e..0e9724a15 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -11,7 +11,7 @@
["/" text (#+ Char) ("#\." monoid)]
["." product]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[macro
["." code]
["." template]]
@@ -40,13 +40,13 @@
(exception: .public (unconsumed_input {offset Offset} {tape Text})
(exception.report
- ["Offset" (n\encode offset)]
- ["Input size" (n\encode (/.size tape))]
+ ["Offset" (n\encoded offset)]
+ ["Input size" (n\encoded (/.size tape))]
["Remaining input" (remaining' offset tape)]))
(exception: .public (expected_to_fail {offset Offset} {tape Text})
(exception.report
- ["Offset" (n\encode offset)]
+ ["Offset" (n\encoded offset)]
["Input" (remaining' offset tape)]))
(exception: .public cannot_parse)
@@ -73,12 +73,12 @@
(do //.monad
[offset ..offset
slices parser]
- (in (list\fold (function (_ [slice::basis slice::distance]
- [total::basis total::distance])
- [total::basis ("lux i64 +" slice::distance total::distance)])
- {#basis offset
- #distance 0}
- slices))))
+ (in (list\mix (function (_ [slice::basis slice::distance]
+ [total::basis total::distance])
+ [total::basis ("lux i64 +" slice::distance total::distance)])
+ {#basis offset
+ #distance 0}
+ slices))))
(def: .public any
(Parser Text)
@@ -202,9 +202,8 @@
[character_should_not_be]
)
-(template [<name> <modifier> <exception> <description_modifier>]
+(template [<name> <modifier> <exception>]
[(def: .public (<name> options)
- {#.doc (code.text ($_ /\compose "Yields characters that are" <description_modifier> " part of a piece of text."))}
(-> Text (Parser Text))
(function (_ [offset tape])
(case (/.char offset tape)
@@ -217,13 +216,12 @@
_
(exception.except ..cannot_parse []))))]
- [one_of |> ..character_should_be ""]
- [none_of .not ..character_should_not_be " not"]
+ [one_of |> ..character_should_be]
+ [none_of .not ..character_should_not_be]
)
-(template [<name> <modifier> <exception> <description_modifier>]
+(template [<name> <modifier> <exception>]
[(def: .public (<name> options)
- {#.doc (code.text ($_ /\compose "Yields characters (as a slice) that are" <description_modifier> " part of a piece of text."))}
(-> Text (Parser Slice))
(function (_ [offset tape])
(case (/.char offset tape)
@@ -238,8 +236,8 @@
_
(exception.except ..cannot_slice []))))]
- [one_of! |> ..character_should_be ""]
- [none_of! .not ..character_should_not_be " not"]
+ [one_of! |> ..character_should_be]
+ [none_of! .not ..character_should_not_be]
)
(exception: .public (character_does_not_satisfy_predicate {character Char})
diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux
index 1f7a54a1a..0208134a3 100644
--- a/stdlib/source/library/lux/control/parser/tree.lux
+++ b/stdlib/source/library/lux/control/parser/tree.lux
@@ -32,9 +32,8 @@
(exception: .public cannot_move_further)
-(template [<name> <direction> <doc>]
+(template [<name> <direction>]
[(def: .public <name>
- {#.doc (example <doc>)}
(All [t] (Parser t []))
(function (_ zipper)
(case (<direction> zipper)
@@ -44,28 +43,18 @@
(#.Some next)
(#try.Success [next []]))))]
- [down zipper.down
- "Move down."]
- [up zipper.up
- "Move up."]
+ [down zipper.down]
+ [up zipper.up]
- [right zipper.right
- "Move to the right."]
- [rightmost zipper.rightmost
- "Move to the rightmost node."]
+ [right zipper.right]
+ [rightmost zipper.rightmost]
- [left zipper.left
- "Move to the left."]
- [leftmost zipper.leftmost
- "Move to the leftmost node."]
+ [left zipper.left]
+ [leftmost zipper.leftmost]
- [next zipper.next
- "Move to the next node."]
- [end zipper.end
- "Move to the last node."]
+ [next zipper.next]
+ [end zipper.end]
- [previous zipper.previous
- "Move to the previous node."]
- [start zipper.start
- "Move to the root node."]
+ [previous zipper.previous]
+ [start zipper.start]
)
diff --git a/stdlib/source/library/lux/control/parser/type.lux b/stdlib/source/library/lux/control/parser/type.lux
index 029d130fd..0b726282a 100644
--- a/stdlib/source/library/lux/control/parser/type.lux
+++ b/stdlib/source/library/lux/control/parser/type.lux
@@ -14,8 +14,7 @@
["." list ("#\." functor)]
["." dictionary (#+ Dictionary)]]]
[macro
- ["." code]
- ["." template]]
+ ["." code]]
[math
[number
["n" nat ("#\." decimal)]]]
@@ -133,7 +132,7 @@
(def: (label idx)
(-> Nat Code)
- (code.local_identifier ($_ text\compose "label" text.tab (n\encode idx))))
+ (code.local_identifier ($_ text\compose "label" text.tab (n\encoded idx))))
(def: .public (with_extension type poly)
(All [a] (-> Type (Parser a) (Parser [Code a])))
@@ -151,7 +150,6 @@
(template [<name> <flattener> <tag> <exception>]
[(`` (def: .public (<name> poly)
- {#.doc (example (~~ (template.text ["Parses the contents of a " <name> " type."])))}
(All [a] (-> (Parser a) (Parser a)))
(do //.monad
[headT ..any]
diff --git a/stdlib/source/library/lux/control/parser/xml.lux b/stdlib/source/library/lux/control/parser/xml.lux
index 2b0332544..2e982ad45 100644
--- a/stdlib/source/library/lux/control/parser/xml.lux
+++ b/stdlib/source/library/lux/control/parser/xml.lux
@@ -35,7 +35,7 @@
(exception: .public (unconsumed_inputs {inputs (List XML)})
(exception.report
- ["Inputs" (exception.listing (\ /.codec encode) inputs)]))
+ ["Inputs" (exception.listing (\ /.codec encoded) inputs)]))
(def: (result' parser attrs documents)
(All [a] (-> (Parser a) Attrs (List XML) (Try a)))
diff --git a/stdlib/source/library/lux/control/pipe.lux b/stdlib/source/library/lux/control/pipe.lux
index b194d6749..8fda36325 100644
--- a/stdlib/source/library/lux/control/pipe.lux
+++ b/stdlib/source/library/lux/control/pipe.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Composable extensions to the piping macros (|> and <|) that enhance them with various abilities."}
[library
[lux #*
[abstract
@@ -11,7 +10,7 @@
[data
["." identity]
[collection
- ["." list ("#\." fold monad)]]]
+ ["." list ("#\." monad)]]]
[macro (#+ with_identifiers)
[syntax (#+ syntax:)]
["." code]]
diff --git a/stdlib/source/library/lux/control/reader.lux b/stdlib/source/library/lux/control/reader.lux
index e1ffffd7b..7d6462858 100644
--- a/stdlib/source/library/lux/control/reader.lux
+++ b/stdlib/source/library/lux/control/reader.lux
@@ -33,7 +33,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ env)
((ff env) (fa env)))))
diff --git a/stdlib/source/library/lux/control/region.lux b/stdlib/source/library/lux/control/region.lux
index 9d9f579c0..1ca544ca6 100644
--- a/stdlib/source/library/lux/control/region.lux
+++ b/stdlib/source/library/lux/control/region.lux
@@ -11,7 +11,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold)]]]]]
+ ["." list ("#\." mix)]]]]]
[//
["." exception (#+ Exception exception:)]])
@@ -59,7 +59,7 @@
[[cleaners output] (computation [[] (list)])]
(|> cleaners
(monad.map ! (function (_ cleaner) (cleaner [])))
- (\ ! map (list\fold clean output)))))
+ (\ ! map (list\mix clean output)))))
(def: .public (acquire! monad cleaner value)
(All [! a] (-> (Monad !) (-> a (! (Try Any))) a
@@ -95,7 +95,7 @@
(def: &functor
(..functor (value@ #monad.&functor super)))
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ [region cleaners])
(do super
[[cleaners ef] (ff [region cleaners])
diff --git a/stdlib/source/library/lux/control/remember.lux b/stdlib/source/library/lux/control/remember.lux
index 9c6e7a97e..eaba75049 100644
--- a/stdlib/source/library/lux/control/remember.lux
+++ b/stdlib/source/library/lux/control/remember.lux
@@ -40,7 +40,7 @@
<c>.int)
(do <>.monad
[raw <c>.text]
- (case (\ date.codec decode raw)
+ (case (\ date.codec decoded raw)
(#try.Success date)
(in date)
@@ -65,13 +65,6 @@
[(`` (syntax: .public (<name> [deadline ..deadline
message <c>.text
focus (<>.maybe <c>.any)])
- {#.doc (example (~~ (template.text ["A " <message> " message with an expiration date."]))
- "Can have an optional piece of code to focus on."
- (<name> "2022-04-01"
- "Do this, that and the other.")
- (<name> "2022-04-01"
- "Improve the performace."
- (some (complicated (computation 123)))))}
(in (list (` (..remember (~ (code.text (%.date deadline)))
(~ (code.text (format <message> " " message)))
(~+ (case focus
diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux
index 9e33fa86b..497e250ff 100644
--- a/stdlib/source/library/lux/control/security/policy.lux
+++ b/stdlib/source/library/lux/control/security/policy.lux
@@ -66,7 +66,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(:abstraction ((:representation ff) (:representation fa)))))
(implementation: .public monad
diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux
index 109491fee..586cb652c 100644
--- a/stdlib/source/library/lux/control/state.lux
+++ b/stdlib/source/library/lux/control/state.lux
@@ -52,7 +52,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ state)
(let [[state' f] (ff state)
[state'' a] (fa state')]
@@ -101,7 +101,7 @@
(def: &functor (with//functor (\ monad &functor)))
- (def: (apply sFf sFa)
+ (def: (on sFa sFf)
(function (_ state)
(do monad
[[state f] (sFf state)
diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux
index b70813ec9..8366b2efc 100644
--- a/stdlib/source/library/lux/control/thread.lux
+++ b/stdlib/source/library/lux/control/thread.lux
@@ -81,7 +81,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ !)
((ff !) (fa !)))))
diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux
index 05d7d69ea..2a1fce570 100644
--- a/stdlib/source/library/lux/control/try.lux
+++ b/stdlib/source/library/lux/control/try.lux
@@ -29,7 +29,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(case ff
(#Success f)
(case fa
@@ -123,7 +123,7 @@
(#Success value)
#.None
- (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encode)
+ (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encoded)
(name_of ..of_maybe))))))
(macro: .public (else tokens compiler)
diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux
index 194822f60..d42e57780 100644
--- a/stdlib/source/library/lux/control/writer.lux
+++ b/stdlib/source/library/lux/control/writer.lux
@@ -3,7 +3,7 @@
[lux #*
["@" target]
[abstract
- monoid
+ [monoid (#+ Monoid)]
[apply (#+ Apply)]
["." functor (#+ Functor)]
["." monad (#+ Monad do)]]]])
@@ -30,7 +30,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(let [[log1 f] ff
[log2 a] fa]
[(\ monoid compose log1 log2) (f a)])))
diff --git a/stdlib/source/library/lux/data/bit.lux b/stdlib/source/library/lux/data/bit.lux
index 6d7b7c9c3..38f7b5f8d 100644
--- a/stdlib/source/library/lux/data/bit.lux
+++ b/stdlib/source/library/lux/data/bit.lux
@@ -49,12 +49,12 @@
(implementation: .public codec
(Codec Text Bit)
- (def: (encode x)
+ (def: (encoded x)
(if x
"#1"
"#0"))
- (def: (decode input)
+ (def: (decoded input)
(case input
"#1" (#.Right #1)
"#0" (#.Right #0)
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index c7fe53e3f..4ec5d1612 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -6,14 +6,14 @@
[monoid (#+ Monoid)]
[functor (#+ Functor)]
[equivalence (#+ Equivalence)]
- [fold (#+ Fold)]
+ [mix (#+ Mix)]
[predicate (#+ Predicate)]]
[control
["." maybe]]
[data
["." product]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
[number
["n" nat]]]]])
@@ -178,27 +178,27 @@
(Array a)))
(if (n.= 0 length)
dest_array
- (list\fold (function (_ offset target)
- (case (read! (n.+ offset src_start) src_array)
- #.None
- target
-
- (#.Some value)
- (write! (n.+ offset dest_start) value target)))
- dest_array
- (list.indices length))))
+ (list\mix (function (_ offset target)
+ (case (read! (n.+ offset src_start) src_array)
+ #.None
+ target
+
+ (#.Some value)
+ (write! (n.+ offset dest_start) value target)))
+ dest_array
+ (list.indices length))))
(def: .public (occupancy array)
(All [a] (-> (Array a) Nat))
- (list\fold (function (_ idx count)
- (case (read! idx array)
- #.None
- count
-
- (#.Some _)
- (++ count)))
- 0
- (list.indices (size array))))
+ (list\mix (function (_ idx count)
+ (case (read! idx array)
+ #.None
+ count
+
+ (#.Some _)
+ (++ count)))
+ 0
+ (list.indices (size array))))
(def: .public (vacancy array)
(All [a] (-> (Array a) Nat))
@@ -207,17 +207,17 @@
(def: .public (filter! p xs)
(All [a]
(-> (Predicate a) (Array a) (Array a)))
- (list\fold (function (_ idx xs')
- (case (read! idx xs)
- #.None
- xs'
-
- (#.Some x)
- (if (p x)
- xs'
- (delete! idx xs'))))
- xs
- (list.indices (size xs))))
+ (list\mix (function (_ idx xs')
+ (case (read! idx xs)
+ #.None
+ xs'
+
+ (#.Some x)
+ (if (p x)
+ xs'
+ (delete! idx xs'))))
+ xs
+ (list.indices (size xs))))
(def: .public (example p xs)
(All [a]
@@ -254,22 +254,22 @@
(def: .public (clone xs)
(All [a] (-> (Array a) (Array a)))
(let [arr_size (size xs)]
- (list\fold (function (_ idx ys)
- (case (read! idx xs)
- #.None
- ys
+ (list\mix (function (_ idx ys)
+ (case (read! idx xs)
+ #.None
+ ys
- (#.Some x)
- (write! idx x ys)))
- (empty arr_size)
- (list.indices arr_size))))
+ (#.Some x)
+ (write! idx x ys)))
+ (empty arr_size)
+ (list.indices arr_size))))
(def: .public (of_list xs)
(All [a] (-> (List a) (Array a)))
- (product.right (list\fold (function (_ x [idx arr])
- [(++ idx) (write! idx x arr)])
- [0 (empty (list.size xs))]
- xs)))
+ (product.right (list\mix (function (_ x [idx arr])
+ [(++ idx) (write! idx x arr)])
+ [0 (empty (list.size xs))]
+ xs)))
(def: underflow
Nat
@@ -312,19 +312,19 @@
(let [sxs (size xs)
sxy (size ys)]
(and (n.= sxy sxs)
- (list\fold (function (_ idx prev)
- (and prev
- (case [(read! idx xs) (read! idx ys)]
- [#.None #.None]
- true
+ (list\mix (function (_ idx prev)
+ (and prev
+ (case [(read! idx xs) (read! idx ys)]
+ [#.None #.None]
+ true
- [(#.Some x) (#.Some y)]
- (,\= x y)
+ [(#.Some x) (#.Some y)]
+ (,\= x y)
- _
- false)))
- true
- (list.indices sxs))))))
+ _
+ false)))
+ true
+ (list.indices sxs))))))
(implementation: .public monoid
(All [a] (Monoid (Array a)))
@@ -345,21 +345,21 @@
(let [arr_size (size ma)]
(if (n.= 0 arr_size)
(empty arr_size)
- (list\fold (function (_ idx mb)
- (case (read! idx ma)
- #.None
- mb
-
- (#.Some x)
- (write! idx (f x) mb)))
- (empty arr_size)
- (list.indices arr_size))
+ (list\mix (function (_ idx mb)
+ (case (read! idx ma)
+ #.None
+ mb
+
+ (#.Some x)
+ (write! idx (f x) mb)))
+ (empty arr_size)
+ (list.indices arr_size))
))))
-(implementation: .public fold
- (Fold Array)
+(implementation: .public mix
+ (Mix Array)
- (def: (fold f init xs)
+ (def: (mix f init xs)
(let [arr_size (size xs)]
(loop [so_far init
idx 0]
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index 6c375247c..34e45b10f 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -8,7 +8,7 @@
["." maybe]]
[data
[collection
- ["." array (#+ Array) ("#\." fold)]]]
+ ["." array (#+ Array) ("#\." mix)]]]
[math
[number
["n" nat]
@@ -33,10 +33,10 @@
(def: .public (size bits)
(-> Bits Nat)
- (array\fold (function (_ chunk total)
- (|> chunk i64.ones (n.+ total)))
- 0
- bits))
+ (array\mix (function (_ chunk total)
+ (|> chunk i64.ones (n.+ total)))
+ 0
+ bits))
(def: .public (capacity bits)
(-> Bits Nat)
diff --git a/stdlib/source/library/lux/data/collection/dictionary.lux b/stdlib/source/library/lux/data/collection/dictionary.lux
index faab0f7b2..afc1cd356 100644
--- a/stdlib/source/library/lux/data/collection/dictionary.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary.lux
@@ -12,8 +12,8 @@
[data
["." product]
[collection
- ["." list ("#\." fold functor monoid)]
- ["." array (#+ Array) ("#\." functor fold)]]]
+ ["." list ("#\." mix functor monoid)]
+ ["." array (#+ Array) ("#\." functor mix)]]]
[math
["." number
["n" nat]
@@ -234,19 +234,19 @@
... nodes to save space.
(def: (demotion except_idx [h_size h_array])
(All [k v] (-> Index (Hierarchy k v) [Bit_Map (Base k v)]))
- (product.right (list\fold (function (_ idx [insertion_idx node])
- (let [[bitmap base] node]
- (case (array.read! idx h_array)
- #.None [insertion_idx node]
- (#.Some sub_node) (if (n.= except_idx idx)
- [insertion_idx node]
- [(++ insertion_idx)
- [(with_bit_position (to_bit_position idx) bitmap)
- (array.write! insertion_idx (#.Left sub_node) base)]])
- )))
- [0 [clean_bitmap
- (array.empty (-- h_size))]]
- (list.indices (array.size h_array)))))
+ (product.right (list\mix (function (_ idx [insertion_idx node])
+ (let [[bitmap base] node]
+ (case (array.read! idx h_array)
+ #.None [insertion_idx node]
+ (#.Some sub_node) (if (n.= except_idx idx)
+ [insertion_idx node]
+ [(++ insertion_idx)
+ [(with_bit_position (to_bit_position idx) bitmap)
+ (array.write! insertion_idx (#.Left sub_node) base)]])
+ )))
+ [0 [clean_bitmap
+ (array.empty (-- h_size))]]
+ (list.indices (array.size h_array)))))
... When #Base nodes grow too large, they're promoted to #Hierarchy to
... add some depth to the tree and help keep its balance.
@@ -260,25 +260,25 @@
(Hash k) Level
Bit_Map (Base k v)
(Array (Node k v))))
- (product.right (list\fold (function (_ hierarchy_idx (^@ default [base_idx h_array]))
- (if (with_bit_position? (to_bit_position hierarchy_idx)
- bitmap)
- [(++ base_idx)
- (case (array.read! base_idx base)
- (#.Some (#.Left sub_node))
- (array.write! hierarchy_idx sub_node h_array)
-
- (#.Some (#.Right [key' val']))
- (array.write! hierarchy_idx
- (node\has (level_up level) (\ key_hash hash key') key' val' key_hash empty_node)
- h_array)
-
- #.None
- (undefined))]
- default))
- [0
- (array.empty hierarchy_nodes_size)]
- hierarchy_indices)))
+ (product.right (list\mix (function (_ hierarchy_idx (^@ default [base_idx h_array]))
+ (if (with_bit_position? (to_bit_position hierarchy_idx)
+ bitmap)
+ [(++ base_idx)
+ (case (array.read! base_idx base)
+ (#.Some (#.Left sub_node))
+ (array.write! hierarchy_idx sub_node h_array)
+
+ (#.Some (#.Right [key' val']))
+ (array.write! hierarchy_idx
+ (node\has (level_up level) (\ key_hash hash key') key' val' key_hash empty_node)
+ h_array)
+
+ #.None
+ (undefined))]
+ default))
+ [0
+ (array.empty hierarchy_nodes_size)]
+ hierarchy_indices)))
... All empty nodes look the same (a #Base node with clean bitmap is
... used).
@@ -518,14 +518,14 @@
(All [k v] (-> (Node k v) Nat))
(case node
(#Hierarchy _size hierarchy)
- (array\fold n.+ 0 (array\map size' hierarchy))
+ (array\mix n.+ 0 (array\map size' hierarchy))
(#Base _ base)
- (array\fold n.+ 0 (array\map (function (_ sub_node')
- (case sub_node'
- (#.Left sub_node) (size' sub_node)
- (#.Right _) 1))
- base))
+ (array\mix n.+ 0 (array\map (function (_ sub_node')
+ (case sub_node'
+ (#.Left sub_node) (size' sub_node)
+ (#.Right _) 1))
+ base))
(#Collisions hash colls)
(array.size colls)
@@ -535,25 +535,25 @@
(All [k v] (-> (Node k v) (List [k v])))
(case node
(#Hierarchy _size hierarchy)
- (array\fold (function (_ sub_node tail) (list\compose (entries' sub_node) tail))
- #.End
- hierarchy)
+ (array\mix (function (_ sub_node tail) (list\compose (entries' sub_node) tail))
+ #.End
+ hierarchy)
(#Base bitmap base)
- (array\fold (function (_ branch tail)
- (case branch
- (#.Left sub_node)
- (list\compose (entries' sub_node) tail)
-
- (#.Right [key' val'])
- (#.Item [key' val'] tail)))
- #.End
- base)
+ (array\mix (function (_ branch tail)
+ (case branch
+ (#.Left sub_node)
+ (list\compose (entries' sub_node) tail)
+
+ (#.Right [key' val'])
+ (#.Item [key' val'] tail)))
+ #.End
+ base)
(#Collisions hash colls)
- (array\fold (function (_ [key' val'] tail) (#.Item [key' val'] tail))
- #.End
- colls)))
+ (array\mix (function (_ [key' val'] tail) (#.Item [key' val'] tail))
+ #.End
+ colls)))
(type: .public (Dictionary k v)
{#hash (Hash k)
@@ -627,18 +627,18 @@
(def: .public (of_list key_hash kvs)
(All [k v] (-> (Hash k) (List [k v]) (Dictionary k v)))
- (list\fold (function (_ [k v] dict)
- (..has k v dict))
- (empty key_hash)
- kvs))
+ (list\mix (function (_ [k v] dict)
+ (..has k v dict))
+ (empty key_hash)
+ kvs))
(template [<side> <name>]
[(def: .public <name>
(All [k v] (-> (Dictionary k v) (List <side>)))
(|>> ..entries
- (list\fold (function (_ [k v] bundle)
- (#.Item <side> bundle))
- #.End)))]
+ (list\mix (function (_ [k v] bundle)
+ (#.Item <side> bundle))
+ #.End)))]
[k keys]
[v values]
@@ -646,21 +646,21 @@
(def: .public (merged dict2 dict1)
(All [k v] (-> (Dictionary k v) (Dictionary k v) (Dictionary k v)))
- (list\fold (function (_ [key val] dict) (has key val dict))
- dict1
- (entries dict2)))
+ (list\mix (function (_ [key val] dict) (has key val dict))
+ dict1
+ (entries dict2)))
(def: .public (merged_with f dict2 dict1)
(All [k v] (-> (-> v v v) (Dictionary k v) (Dictionary k v) (Dictionary k v)))
- (list\fold (function (_ [key val2] dict)
- (case (value key dict)
- #.None
- (has key val2 dict)
+ (list\mix (function (_ [key val2] dict)
+ (case (value key dict)
+ #.None
+ (has key val2 dict)
- (#.Some val1)
- (has key (f val2 val1) dict)))
- dict1
- (entries dict2)))
+ (#.Some val1)
+ (has key (f val2 val1) dict)))
+ dict1
+ (entries dict2)))
(def: .public (re_bound from_key to_key dict)
(All [k v] (-> k k (Dictionary k v) (Dictionary k v)))
@@ -676,12 +676,12 @@
(def: .public (sub keys dict)
(All [k v] (-> (List k) (Dictionary k v) (Dictionary k v)))
(let [[key_hash _] dict]
- (list\fold (function (_ key new_dict)
- (case (value key dict)
- #.None new_dict
- (#.Some val) (has key val new_dict)))
- (empty key_hash)
- keys)))
+ (list\mix (function (_ key new_dict)
+ (case (value key dict)
+ #.None new_dict
+ (#.Some val) (has key val new_dict)))
+ (empty key_hash)
+ keys)))
(implementation: .public (equivalence (^open ",\."))
(All [k v] (-> (Equivalence v) (Equivalence (Dictionary k v))))
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index f19843db9..49d4068d5 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -10,10 +10,7 @@
[data
["p" product]
[collection
- ["." list ("#\." monoid fold)]]]
- [macro
- ["." code]
- ["." template]]
+ ["." list ("#\." monoid mix)]]]
[math
[number
["n" nat]]]]])
@@ -101,7 +98,6 @@
(template [<name> <side>]
[(def: .public (<name> dict)
- {#.doc (example (~~ (template.text ["Yields value under the " <name> "imum key."])))}
(All [k v] (-> (Dictionary k v) (Maybe v)))
(case (value@ #root dict)
#.None
@@ -537,10 +533,10 @@
(def: .public (of_list order list)
(All [k v] (-> (Order k) (List [k v]) (Dictionary k v)))
- (list\fold (function (_ [key value] dict)
- (has key value dict))
- (empty order)
- list))
+ (list\mix (function (_ [key value] dict)
+ (has key value dict))
+ (empty order)
+ list))
(template [<name> <type> <output>]
[(def: .public (<name> dict)
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index a4bb340e7..98a3224e4 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -7,7 +7,7 @@
[apply (#+ Apply)]
[equivalence (#+ Equivalence)]
[hash (#+ Hash)]
- [fold (#+ Fold)]
+ [mix (#+ Mix)]
[predicate (#+ Predicate)]
["." functor (#+ Functor)]
["." monad (#+ do Monad)]
@@ -23,32 +23,32 @@
... #End
... (#Item a (List a)))
-(implementation: .public fold
- (Fold List)
+(implementation: .public mix
+ (Mix List)
- (def: (fold f init xs)
+ (def: (mix f init xs)
(case xs
#.End
init
(#.Item x xs')
- (fold f (f x init) xs'))))
+ (mix f (f x init) xs'))))
-(def: .public (aggregates f init inputs)
+(def: .public (mixes f init inputs)
(All [a b] (-> (-> a b b) b (List a) (List b)))
(case inputs
#.End
(list init)
(#.Item [head tail])
- (#.Item [init (aggregates f (f head init) tail)])))
+ (#.Item [init (mixes f (f head init) tail)])))
(def: .public (reversed xs)
(All [a]
(-> (List a) (List a)))
- (fold (function (_ head tail) (#.Item head tail))
- #.End
- xs))
+ (mix (function (_ head tail) (#.Item head tail))
+ #.End
+ xs))
(def: .public (only keep? xs)
(All [a]
@@ -205,15 +205,15 @@
(-> (-> a (Maybe b)) (List a) (List b)))
(for {... TODO: Stop relying on this ASAP.
@.js
- (fold (function (_ head tail)
- (case (check head)
- (#.Some head)
- (#.Item head tail)
-
- #.None
- tail))
- #.End
- (reversed xs))}
+ (mix (function (_ head tail)
+ (case (check head)
+ (#.Some head)
+ (#.Item head tail)
+
+ #.None
+ tail))
+ #.End
+ (reversed xs))}
(case xs
#.End
#.End
@@ -250,7 +250,7 @@
(def: .public (size list)
(All [a] (-> (List a) Nat))
- (fold (function (_ _ acc) (n.+ 1 acc)) 0 list))
+ (mix (function (_ _ acc) (n.+ 1 acc)) 0 list))
(template [<name> <init> <op>]
[(def: .public (<name> predicate items)
@@ -303,7 +303,7 @@
(..equivalence (\ super &equivalence)))
(def: hash
- (\ ..fold fold
+ (\ ..mix mix
(function (_ member hash)
(n.+ (\ super hash member) hash))
0)))
@@ -340,13 +340,15 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(case ff
#.End
#.End
(#.Item f ff')
- (compose (map f fa) (apply ff' fa)))))
+ (|> ff'
+ (on fa)
+ (compose (map f fa))))))
(implementation: .public monad
(Monad List)
@@ -357,7 +359,7 @@
(#.Item a #.End))
(def: join
- (|>> reversed (fold compose identity))))
+ (|>> reversed (mix compose identity))))
(def: .public (sorted < xs)
(All [a] (-> (-> a a Bit) (List a) (List a)))
@@ -366,12 +368,12 @@
(list)
(#.Item x xs')
- (let [[pre post] (fold (function (_ x' [pre post])
- (if (< x x')
- [(#.Item x' pre) post]
- [pre (#.Item x' post)]))
- [(list) (list)]
- xs')]
+ (let [[pre post] (mix (function (_ x' [pre post])
+ (if (< x x')
+ [(#.Item x' pre) post]
+ [pre (#.Item x' post)]))
+ [(list) (list)]
+ xs')]
($_ compose (sorted < pre) (list x) (sorted < post)))))
(def: .public (empty? xs)
@@ -393,9 +395,8 @@
(or (\ eq = x x')
(member? eq xs' x))))
-(template [<name> <output> <side> <doc>]
+(template [<name> <output> <side>]
[(def: .public (<name> xs)
- {#.doc <doc>}
(All [a] (-> (List a) (Maybe <output>)))
(case xs
#.End
@@ -404,8 +405,8 @@
(#.Item x xs')
(#.Some <side>)))]
- [head a x "Yields the first element of a list."]
- [tail (List a) xs' "For a list of size N, yields the N-1 elements after the first one."]
+ [head a x]
+ [tail (List a) xs']
)
(def: .public (indices size)
@@ -418,7 +419,7 @@
(-> Text Code)
[["" 0 0] (#.Identifier "" name)])
-(def: (nat\encode value)
+(def: (nat\encoded value)
(-> Nat Text)
(loop [input value
output ""]
@@ -446,7 +447,7 @@
(if (n.> 0 num_lists)
(let [(^open ".") ..functor
indices (..indices num_lists)
- type_vars (: (List Code) (map (|>> nat\encode identifier$) indices))
+ type_vars (: (List Code) (map (|>> nat\encoded identifier$) indices))
zipped_type (` (All [(~+ type_vars)]
(-> (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
type_vars))
@@ -454,7 +455,7 @@
vars+lists (|> indices
(map ++)
(map (function (_ idx)
- (let [base (nat\encode idx)]
+ (let [base (nat\encoded idx)]
[(identifier$ base)
(identifier$ ("lux text concat" base "'"))]))))
pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs))))
@@ -488,7 +489,7 @@
indices (..indices num_lists)
g!return_type (identifier$ "0return_type0")
g!func (identifier$ "0func0")
- type_vars (: (List Code) (map (|>> nat\encode identifier$) indices))
+ type_vars (: (List Code) (map (|>> nat\encoded identifier$) indices))
zipped_type (` (All [(~+ type_vars) (~ g!return_type)]
(-> (-> (~+ type_vars) (~ g!return_type))
(~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var)))))
@@ -497,7 +498,7 @@
vars+lists (|> indices
(map ++)
(map (function (_ idx)
- (let [base (nat\encode idx)]
+ (let [base (nat\encoded idx)]
[(identifier$ base)
(identifier$ ("lux text concat" base "'"))]))))
pattern (` [(~+ (map (function (_ [v vs]) (` (#.Item (~ v) (~ vs))))
diff --git a/stdlib/source/library/lux/data/collection/row.lux b/stdlib/source/library/lux/data/collection/row.lux
index 16929459e..d7a792cdc 100644
--- a/stdlib/source/library/lux/data/collection/row.lux
+++ b/stdlib/source/library/lux/data/collection/row.lux
@@ -11,7 +11,7 @@
[monad (#+ Monad do)]
[equivalence (#+ Equivalence)]
[monoid (#+ Monoid)]
- [fold (#+ Fold)]
+ [mix (#+ Mix)]
[predicate (#+ Predicate)]]
[control
["." maybe]
@@ -22,8 +22,8 @@
[data
["." product]
[collection
- ["." list ("#\." fold functor monoid)]
- ["." array (#+ Array) ("#\." functor fold)]]]
+ ["." list ("#\." mix functor monoid)]
+ ["." array (#+ Array) ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." code]]
@@ -179,8 +179,8 @@
(|> hierarchy
array.list
list.reversed
- (list\fold (function (_ sub acc) (list\compose (list' sub) acc))
- #.End))))
+ (list\mix (function (_ sub acc) (list\compose (list' sub) acc))
+ #.End))))
(type: .public (Row a)
{#level Level
@@ -235,8 +235,8 @@
(exception: incorrect_row_structure)
(exception: .public [a] (index_out_of_bounds {row (Row a)} {index Nat})
- (exception.report ["Size" (\ n.decimal encode (value@ #size row))]
- ["Index" (\ n.decimal encode index)]))
+ (exception.report ["Size" (\ n.decimal encoded (value@ #size row))]
+ ["Index" (\ n.decimal encoded index)]))
(exception: base_was_not_found)
@@ -346,7 +346,7 @@
(def: .public of_list
(All [a] (-> (List a) (Row a)))
- (list\fold ..suffix ..empty))
+ (list\mix ..suffix ..empty))
(def: .public (member? equivalence row val)
(All [a] (-> (Equivalence a) (Row a) a Bit))
@@ -384,29 +384,29 @@
(node\= (#Hierarchy (value@ #root v1))
(#Hierarchy (value@ #root v2))))))))
-(implementation: node_fold
- (Fold Node)
+(implementation: node_mix
+ (Mix Node)
- (def: (fold f init xs)
+ (def: (mix f init xs)
(case xs
(#Base base)
- (array\fold f init base)
+ (array\mix f init base)
(#Hierarchy hierarchy)
- (array\fold (function (_ node init') (fold f init' node))
- init
- hierarchy))))
+ (array\mix (function (_ node init') (mix f init' node))
+ init
+ hierarchy))))
-(implementation: .public fold
- (Fold Row)
+(implementation: .public mix
+ (Mix Row)
- (def: (fold f init xs)
- (let [(^open ".") node_fold]
- (fold f
- (fold f
- init
- (#Hierarchy (value@ #root xs)))
- (#Base (value@ #tail xs))))))
+ (def: (mix f init xs)
+ (let [(^open ".") node_mix]
+ (mix f
+ (mix f
+ init
+ (#Hierarchy (value@ #root xs)))
+ (#Base (value@ #tail xs))))))
(implementation: .public monoid
(All [a] (Monoid (Row a)))
@@ -414,7 +414,7 @@
(def: identity ..empty)
(def: (compose xs ys)
- (list\fold suffix xs (..list ys))))
+ (list\mix suffix xs (..list ys))))
(implementation: node_functor
(Functor Node)
@@ -441,13 +441,13 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(let [(^open ".") ..functor
- (^open ".") ..fold
+ (^open ".") ..mix
(^open ".") ..monoid
results (map (function (_ f) (map f fa))
ff)]
- (fold compose identity results))))
+ (mix compose identity results))))
(implementation: .public monad
(Monad Row)
@@ -457,15 +457,15 @@
(def: in (|>> row))
(def: join
- (let [(^open ".") ..fold
+ (let [(^open ".") ..mix
(^open ".") ..monoid]
- (fold (function (_ post pre) (compose pre post)) identity))))
+ (mix (function (_ post pre) (compose pre post)) identity))))
(def: .public reversed
(All [a] (-> (Row a) (Row a)))
(|>> ..list
list.reversed
- (list\fold suffix ..empty)))
+ (list\mix suffix ..empty)))
(template [<name> <array> <init> <op>]
[(def: .public <name>
diff --git a/stdlib/source/library/lux/data/collection/set.lux b/stdlib/source/library/lux/data/collection/set.lux
index bd18afe96..00edc5a47 100644
--- a/stdlib/source/library/lux/data/collection/set.lux
+++ b/stdlib/source/library/lux/data/collection/set.lux
@@ -8,7 +8,7 @@
[monoid (#+ Monoid)]]
[data
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
[number
["n" nat]]]]]
@@ -16,8 +16,6 @@
["#" dictionary (#+ Dictionary)]])
(type: .public (Set a)
- {#.doc (example "An un-ordered data-structure with unique items."
- "This means there is no repetition/duplication among the items.")}
(Dictionary a Any))
(def: .public member_hash
@@ -54,7 +52,7 @@
(def: .public (difference sub base)
(All [a] (-> (Set a) (Set a) (Set a)))
- (list\fold ..lacks base (..list sub)))
+ (list\mix ..lacks base (..list sub)))
(def: .public (intersection filter base)
(All [a] (-> (Set a) (Set a) (Set a)))
@@ -92,7 +90,7 @@
(def: .public (of_list hash elements)
(All [a] (-> (Hash a) (List a) (Set a)))
- (list\fold ..has (..empty hash) elements))
+ (list\mix ..has (..empty hash) elements))
(def: .public (sub? super sub)
(All [a] (-> (Set a) (Set a) Bit))
diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux
index b4786c825..f176dc46a 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -15,7 +15,7 @@
[abstract (#+ abstract: :abstraction :representation ^:representation)]]]]
["." //
[//
- ["." list ("#\." fold monoid)]
+ ["." list ("#\." mix monoid)]
["." dictionary (#+ Dictionary)]]])
(abstract: .public (Set a)
@@ -29,7 +29,7 @@
(def: .public size
(All [a] (-> (Set a) Nat))
- (|>> :representation dictionary.values (list\fold n.+ 0)))
+ (|>> :representation dictionary.values (list\mix n.+ 0)))
(def: .public (has multiplicity elem set)
(All [a] (-> Nat a (Set a) (Set a)))
@@ -62,9 +62,9 @@
(All [a] (-> (Set a) (List a)))
(|>> :representation
dictionary.entries
- (list\fold (function (_ [elem multiplicity] output)
- (list\compose (list.repeated multiplicity elem) output))
- #.End)))
+ (list\mix (function (_ [elem multiplicity] output)
+ (list\compose (list.repeated multiplicity elem) output))
+ #.End)))
(template [<name> <compose>]
[(def: .public (<name> parameter subject)
@@ -77,22 +77,22 @@
(def: .public (intersection parameter (^:representation subject))
(All [a] (-> (Set a) (Set a) (Set a)))
- (list\fold (function (_ [elem multiplicity] output)
- (..has (n.min (..multiplicity parameter elem)
- multiplicity)
- elem
- output))
- (..empty (dictionary.key_hash subject))
- (dictionary.entries subject)))
+ (list\mix (function (_ [elem multiplicity] output)
+ (..has (n.min (..multiplicity parameter elem)
+ multiplicity)
+ elem
+ output))
+ (..empty (dictionary.key_hash subject))
+ (dictionary.entries subject)))
(def: .public (difference parameter subject)
(All [a] (-> (Set a) (Set a) (Set a)))
(|> parameter
:representation
dictionary.entries
- (list\fold (function (_ [elem multiplicity] output)
- (..lacks multiplicity elem output))
- subject)))
+ (list\mix (function (_ [elem multiplicity] output)
+ (..lacks multiplicity elem output))
+ subject)))
(def: .public (sub? reference subject)
{#.doc (example "Is 'subject' a sub-set of 'reference'?")}
@@ -133,10 +133,10 @@
(def: (hash (^:representation set))
(let [[hash _] set]
- (list\fold (function (_ [elem multiplicity] acc)
- (|> elem (\ hash hash) (n.* multiplicity) (n.+ acc)))
- 0
- (dictionary.entries set)))))
+ (list\mix (function (_ [elem multiplicity] acc)
+ (|> elem (\ hash hash) (n.* multiplicity) (n.+ acc)))
+ 0
+ (dictionary.entries set)))))
)
(def: .public (member? set elem)
@@ -149,7 +149,7 @@
(def: .public (of_list hash subject)
(All [a] (-> (Hash a) (List a) (Set a)))
- (list\fold (..has 1) (..empty hash) subject))
+ (list\mix (..has 1) (..empty hash) subject))
(def: .public (of_set subject)
(All [a] (-> (//.Set a) (Set a)))
diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux
index 28bbf1876..d6d532d02 100644
--- a/stdlib/source/library/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/set/ordered.lux
@@ -6,7 +6,7 @@
[order (#+ Order)]]
[data
[collection
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
[dictionary
["/" ordered]]]]
[type
@@ -50,11 +50,11 @@
(def: .public (of_list &order list)
(All [a] (-> (Order a) (List a) (Set a)))
- (list\fold has (..empty &order) list))
+ (list\mix has (..empty &order) list))
(def: .public (union left right)
(All [a] (-> (Set a) (Set a) (Set a)))
- (list\fold ..has right (..list left)))
+ (list\mix ..has right (..list left)))
(def: .public (intersection left right)
(All [a] (-> (Set a) (Set a) (Set a)))
diff --git a/stdlib/source/library/lux/data/collection/tree.lux b/stdlib/source/library/lux/data/collection/tree.lux
index 112932a50..bdf10e85b 100644
--- a/stdlib/source/library/lux/data/collection/tree.lux
+++ b/stdlib/source/library/lux/data/collection/tree.lux
@@ -4,14 +4,14 @@
[abstract
[functor (#+ Functor)]
[equivalence (#+ Equivalence)]
- [fold (#+ Fold)]
+ [mix (#+ Mix)]
[monad (#+ do)]]
[control
["<>" parser
["<.>" code (#+ Parser)]]]
[data
[collection
- ["." list ("#\." monad fold)]]]
+ ["." list ("#\." monad mix)]]]
[macro
[syntax (#+ syntax:)]
["." code]]]])
@@ -80,11 +80,11 @@
#children (list\map (map f)
(value@ #children fa))}))
-(implementation: .public fold
- (Fold Tree)
+(implementation: .public mix
+ (Mix Tree)
- (def: (fold f init tree)
- (list\fold (function (_ tree' init') (fold f init' tree'))
- (f (value@ #value tree)
- init)
- (value@ #children tree))))
+ (def: (mix f init tree)
+ (list\mix (function (_ tree' init') (mix f init' tree'))
+ (f (value@ #value tree)
+ init)
+ (value@ #children tree))))
diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux
index 6d1709c55..1c99353bc 100644
--- a/stdlib/source/library/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux
@@ -14,7 +14,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold monoid)]]]]]
+ ["." list ("#\." functor monoid)]]]]]
["." // (#+ Tree) ("#\." functor)])
(type: (Family Zipper a)
diff --git a/stdlib/source/library/lux/data/color.lux b/stdlib/source/library/lux/data/color.lux
index d34918cf2..fb67c971f 100644
--- a/stdlib/source/library/lux/data/color.lux
+++ b/stdlib/source/library/lux/data/color.lux
@@ -9,14 +9,8 @@
[parser
["<.>" code]]]
[data
- ["." text
- ["%" format (#+ format)]]
[collection
["." list ("#\." functor)]]]
- [macro
- [syntax (#+ syntax:)]
- ["." template]
- ["." code]]
["." math
[number
["n" nat]
@@ -355,14 +349,8 @@
+0.0
luminance])))
-(syntax: (color_scheme_documentation [name <code>.local_identifier])
- (let [name (text.replaced "_" "-" name)
- g!documentation (code.text (format "A " name " color scheme."))]
- (in (list (` {#.doc (.example (~ g!documentation))})))))
-
(template [<name> <1> <2>]
[(`` (def: .public (<name> color)
- (~~ (..color_scheme_documentation <name>))
(-> Color [Color Color Color])
(let [[hue saturation luminance] (hsl color)]
[color
@@ -380,7 +368,6 @@
(template [<name> <1> <2> <3>]
[(`` (def: .public (<name> color)
- (~~ (..color_scheme_documentation <name>))
(-> Color [Color Color Color Color])
(let [[hue saturation luminance] (hsb color)]
[color
diff --git a/stdlib/source/library/lux/data/color/named.lux b/stdlib/source/library/lux/data/color/named.lux
index 5e5e5bc65..43fd25f16 100644
--- a/stdlib/source/library/lux/data/color/named.lux
+++ b/stdlib/source/library/lux/data/color/named.lux
@@ -7,7 +7,6 @@
(template [<red> <green> <blue> <name>]
[(`` (def: .public <name>
- {#.doc (example (~~ (..documentation <red> <green> <blue> <name>)))}
Color
(//.of_rgb {#//.red (hex <red>)
#//.green (hex <green>)
diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux
index bb0510528..85eb0534d 100644
--- a/stdlib/source/library/lux/data/format/binary.lux
+++ b/stdlib/source/library/lux/data/format/binary.lux
@@ -165,7 +165,7 @@
(template [<name> <binary>]
[(def: .public <name>
(Writer Text)
- (|>> (\ utf8.codec encode) <binary>))]
+ (|>> (\ utf8.codec encoded) <binary>))]
[utf8/8 ..binary/8]
[utf8/16 ..binary/16]
@@ -188,7 +188,7 @@
(^open "specification\.") ..monoid
[size mutation] (|> value
(row\map valueW)
- (\ row.fold fold
+ (\ row.mix mix
(function (_ post pre)
(specification\compose pre post))
specification\identity))]
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index 8b3a9270c..75e886e0d 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -53,8 +53,8 @@
(-> Font (CSS Special))
(let [with_unicode (case (value@ #/font.unicode_range font)
(#.Some unicode_range)
- (let [unicode_range' (format "U+" (\ nat.hex encode (value@ #/font.start unicode_range))
- "-" (\ nat.hex encode (value@ #/font.end unicode_range)))]
+ (let [unicode_range' (format "U+" (\ nat.hex encoded (value@ #/font.start unicode_range))
+ "-" (\ nat.hex encoded (value@ #/font.end unicode_range)))]
(list ["unicode-range" unicode_range']))
#.None
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index 3a8daf5c0..5bb422c0d 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -9,7 +9,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[type
abstract]
[host
@@ -219,7 +219,7 @@
(def: .public (svg attributes content)
(-> Attributes XML Element)
(|> content
- (\ xml.codec encode)
+ (\ xml.codec encoded)
(..raw "svg" attributes)))
(type: .public Coord
@@ -300,7 +300,7 @@
(#.Item head tail)
(..tag "map" attributes
- (list\fold (function.flipped ..and) head tail)))))
+ (list\mix (function.flipped ..and) head tail)))))
(template [<name> <tag> <type>]
[(def: .public <name>
@@ -465,7 +465,7 @@
(#.Item head tail)
(..tag "dl" attributes
- (list\fold (function.flipped ..and) head tail))))
+ (list\mix (function.flipped ..and) head tail))))
(def: .public p ..paragraph)
@@ -524,7 +524,7 @@
(#.Item first rest)
(..and head
(..table_body
- (list\fold (function.flipped ..and) first rest))))
+ (list\mix (function.flipped ..and) first rest))))
content (case footer
#.None
content
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index ed2643efa..bcfd44f80 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -19,7 +19,7 @@
["." product]
["." text ("#\." equivalence monoid)]
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
["." row (#+ Row row) ("#\." monad)]
["." dictionary (#+ Dictionary)]]]
[macro
@@ -169,25 +169,25 @@
[(#Array xs) (#Array ys)]
(and (n.= (row.size xs) (row.size ys))
- (list\fold (function (_ idx prev)
- (and prev
- (maybe.else #0
- (do maybe.monad
- [x' (row.item idx xs)
- y' (row.item idx ys)]
- (in (= x' y'))))))
- #1
- (list.indices (row.size xs))))
+ (list\mix (function (_ idx prev)
+ (and prev
+ (maybe.else #0
+ (do maybe.monad
+ [x' (row.item idx xs)
+ y' (row.item idx ys)]
+ (in (= x' y'))))))
+ #1
+ (list.indices (row.size xs))))
[(#Object xs) (#Object ys)]
(and (n.= (dictionary.size xs) (dictionary.size ys))
- (list\fold (function (_ [xk xv] prev)
- (and prev
- (case (dictionary.value xk ys)
- #.None #0
- (#.Some yv) (= xv yv))))
- #1
- (dictionary.entries xs)))
+ (list\mix (function (_ [xk xv] prev)
+ (and prev
+ (case (dictionary.value xk ys)
+ #.None #0
+ (#.Some yv) (= xv yv))))
+ #1
+ (dictionary.entries xs)))
_
#0)))
@@ -210,7 +210,7 @@
(-> Number Text)
(|>> (case>
(^or +0.0 -0.0) "0.0"
- value (let [raw (\ f.decimal encode value)]
+ value (let [raw (\ f.decimal encoded value)]
(if (f.< +0.0 value)
raw
(|> raw (text.split_at 1) maybe.trusted product.right))))))
@@ -327,7 +327,7 @@
signed?' (<>.parses? (<text>.this "-"))
offset (<text>.many <text>.decimal)]
(in ($_ text\compose mark (if signed?' "-" "") offset))))]
- (case (f\decode ($_ text\compose (if signed? "-" "") digits "." decimals exp))
+ (case (f\decoded ($_ text\compose (if signed? "-" "") digits "." decimals exp))
(#try.Failure message)
(<>.failure message)
@@ -406,5 +406,5 @@
(implementation: .public codec
(Codec Text JSON)
- (def: encode ..format)
- (def: decode (<text>.result json_parser)))
+ (def: encoded ..format)
+ (def: decoded (<text>.result json_parser)))
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index 59a24a875..f452a2693 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -19,8 +19,8 @@
["." format #_
["#" binary (#+ Writer) ("#\." monoid)]]
[collection
- ["." list ("#\." fold)]
- ["." row (#+ Row) ("#\." fold)]]]
+ ["." list ("#\." mix)]
+ ["." row (#+ Row) ("#\." mix)]]]
[math
["." number
["n" nat]
@@ -62,7 +62,7 @@
Nat
(|> ..octal_size
(list.repeated <size>)
- (list\fold n.* 1)
+ (list\mix n.* 1)
++))
(exception: .public (<exception> {value Nat})
@@ -90,10 +90,10 @@
(let [suffix <suffix>
padded_size (n.+ (text.size suffix) <size>)]
(|>> :representation
- (\ n.octal encode)
+ (\ n.octal encoded)
(..octal_padding <size>)
(text.suffix suffix)
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
(format.segment padded_size))))
(def: <coercion>
@@ -134,25 +134,25 @@
(Parser Small)
(do <>.monad
[digits (<binary>.segment ..small_size)
- digits (<>.lifted (\ utf8.codec decode digits))
+ digits (<>.lifted (\ utf8.codec decoded digits))
_ ..small_suffix]
(<>.lifted
(do {! try.monad}
- [value (\ n.octal decode digits)]
+ [value (\ n.octal decoded digits)]
(..small value)))))
(def: big_parser
(Parser Big)
(do <>.monad
[digits (<binary>.segment ..big_size)
- digits (<>.lifted (\ utf8.codec decode digits))
+ digits (<>.lifted (\ utf8.codec decoded digits))
end <binary>.bits/8
_ (let [expected (`` (char (~~ (static ..blank))))]
(<>.assertion (exception.error ..wrong_character [expected end])
(n.= expected end)))]
(<>.lifted
(do {! try.monad}
- [value (\ n.octal decode digits)]
+ [value (\ n.octal decoded digits)]
(..big value)))))
(abstract: Checksum
@@ -178,7 +178,7 @@
(def: checksum_checksum
(|> ..dummy_checksum
:representation
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
..checksum))
(def: checksum_code
@@ -186,7 +186,7 @@
(|>> ..checksum
..as_small
..from_small
- (\ n.octal encode)
+ (\ n.octal encoded)
(..octal_padding ..small_size)
(text.suffix ..checksum_suffix)
:abstraction))
@@ -196,17 +196,17 @@
(let [padded_size (n.+ (text.size ..checksum_suffix)
..small_size)]
(|>> :representation
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
(format.segment padded_size))))
(def: checksum_parser
(Parser [Nat Checksum])
(do <>.monad
[ascii (<binary>.segment ..small_size)
- digits (<>.lifted (\ utf8.codec decode ascii))
+ digits (<>.lifted (\ utf8.codec decoded ascii))
_ ..small_suffix
value (<>.lifted
- (\ n.octal decode digits))]
+ (\ n.octal decoded digits))]
(in [value
(:abstraction (format digits ..checksum_suffix))])))
)
@@ -217,7 +217,7 @@
(def: ascii?
(-> Text Bit)
- (|>> (\ utf8.codec encode)
+ (|>> (\ utf8.codec encoded)
(binary.aggregate (function (_ char verdict)
(.and verdict
(n.<= ..last_ascii char)))
@@ -236,7 +236,7 @@
0 (#try.Success string)
size (loop [end (-- size)]
(case end
- 0 (#try.Success (\ utf8.codec encode ""))
+ 0 (#try.Success (\ utf8.codec encoded ""))
_ (do try.monad
[last_char (binary.read/8! end string)]
(`` (case (.nat last_char)
@@ -261,7 +261,7 @@
(def: .public (<in> value)
(-> <representation> (Try <type>))
(if (..ascii? value)
- (if (|> value (\ utf8.codec encode) binary.size (n.<= <size>))
+ (if (|> value (\ utf8.codec encoded) binary.size (n.<= <size>))
(#try.Success (:abstraction value))
(exception.except <exception> [value]))
(exception.except ..not_ascii [value])))
@@ -276,7 +276,7 @@
padded_size (n.+ (text.size suffix) <size>)]
(|>> :representation
(text.suffix suffix)
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
(format.segment padded_size))))
(def: <parser>
@@ -290,7 +290,7 @@
(<>.lifted
(do {! try.monad}
[ascii (..un_padded string)
- text (\ utf8.codec decode ascii)]
+ text (\ utf8.codec decoded ascii)]
(<in> text)))))
(def: .public <none>
@@ -320,7 +320,7 @@
(let [padded_size (n.+ (text.size ..null)
..magic_size)]
(|>> :representation
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
(format.segment padded_size))))
(def: magic_parser
@@ -333,7 +333,7 @@
(n.= expected end))]
(<>.lifted
(\ try.monad map (|>> :abstraction)
- (\ utf8.codec decode string)))))
+ (\ utf8.codec decoded string)))))
)
(def: block_size Size 512)
@@ -530,7 +530,7 @@
Nat
(|> ..octal_size
(list.repeated ..content_size)
- (list\fold n.* 1)))
+ (list\mix n.* 1)))
(abstract: .public Content
{}
@@ -739,10 +739,10 @@
(Writer Tar)
(let [end_of_archive (binary.empty ..end_of_archive_size)]
(function (_ tar)
- (format\compose (row\fold (function (_ next total)
- (format\compose total (..entry_writer next)))
- format\identity
- tar)
+ (format\compose (row\mix (function (_ next total)
+ (format\compose total (..entry_writer next)))
+ format\identity
+ tar)
(format.segment ..end_of_archive_size end_of_archive)))))
(exception: .public (wrong_checksum {expected Nat} {actual Nat})
@@ -763,7 +763,7 @@
(-> Checksum Binary Nat)
(let [|checksum| (|> checksum
..from_checksum
- (\ utf8.codec encode)
+ (\ utf8.codec encoded)
..checksum)]
(|> (..checksum header)
(n.- |checksum|)
diff --git a/stdlib/source/library/lux/data/format/xml.lux b/stdlib/source/library/lux/data/format/xml.lux
index 4e358f91d..064476a7f 100644
--- a/stdlib/source/library/lux/data/format/xml.lux
+++ b/stdlib/source/library/lux/data/format/xml.lux
@@ -127,8 +127,8 @@
(<>.after (<text>.this "/"))
(<text>.enclosed ["<" ">"]))]
(<>.assertion ($_ text\compose "Close tag does not match open tag." text.new_line
- "Expected: " (name\encode expected) text.new_line
- " Actual: " (name\encode actual) text.new_line)
+ "Expected: " (name\encoded expected) text.new_line
+ " Actual: " (name\encoded actual) text.new_line)
(name\= expected actual))))
(def: comment^
@@ -229,7 +229,7 @@
(implementation: .public codec
(Codec Text XML)
- (def: encode
+ (def: encoded
(let [attributes (: (-> Attrs Text)
(function (_ attrs)
(|> attrs
@@ -269,7 +269,7 @@
text.together)
text.new_line prefix "</" tag ">")))))
))))
- (def: decode
+ (def: decoded
(<text>.result ..xml^)))
(implementation: .public equivalence
diff --git a/stdlib/source/library/lux/data/identity.lux b/stdlib/source/library/lux/data/identity.lux
index 72ae09d38..300c0cd7b 100644
--- a/stdlib/source/library/lux/data/identity.lux
+++ b/stdlib/source/library/lux/data/identity.lux
@@ -21,7 +21,8 @@
(Apply Identity)
(def: &functor ..functor)
- (def: (apply ff fa) (ff fa)))
+ (def: (on fa ff)
+ (ff fa)))
(implementation: .public monad
(Monad Identity)
diff --git a/stdlib/source/library/lux/data/name.lux b/stdlib/source/library/lux/data/name.lux
index 3dfa6dcce..99d158095 100644
--- a/stdlib/source/library/lux/data/name.lux
+++ b/stdlib/source/library/lux/data/name.lux
@@ -45,12 +45,12 @@
(implementation: .public codec
(Codec Text Name)
- (def: (encode [module short])
+ (def: (encoded [module short])
(case module
"" short
_ ($_ text\compose module ..separator short)))
- (def: (decode input)
+ (def: (decoded input)
(case (text.all_split_by ..separator input)
(^ (list short))
(#.Right ["" short])
diff --git a/stdlib/source/library/lux/data/product.lux b/stdlib/source/library/lux/data/product.lux
index 9a3bf40dc..1e0bc9c96 100644
--- a/stdlib/source/library/lux/data/product.lux
+++ b/stdlib/source/library/lux/data/product.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Functionality for working with tuples (particularly 2-tuples/pairs)."}
[library
[lux #*
[abstract
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 70b0360b1..5a1b8a981 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -13,7 +13,7 @@
["." maybe]]
[data
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[math
[number
["n" nat]
@@ -288,7 +288,7 @@
(-> (List Text) Text)
(let [(^open ".") ..monoid]
(|>> list.reversed
- (list\fold compose identity))))
+ (list\mix compose identity))))
(def: .public (interposed separator texts)
(-> Text (List Text) Text)
diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux
index 08f640648..e23a11f63 100644
--- a/stdlib/source/library/lux/data/text/buffer.lux
+++ b/stdlib/source/library/lux/data/text/buffer.lux
@@ -11,7 +11,7 @@
["%" format (#+ format)]]
[collection
["." array]
- ["." row (#+ Row) ("#\." fold)]]]
+ ["." row (#+ Row) ("#\." mix)]]]
[math
[number
["n" nat]]]
@@ -108,9 +108,9 @@
@.lua <jvm>}
... default
(|>> :representation
- (row\fold (function (_ chunk total)
- (n.+ (//.size chunk) total))
- 0)))))
+ (row\mix (function (_ chunk total)
+ (n.+ (//.size chunk) total))
+ 0)))))
(def: .public (text buffer)
(-> Buffer Text)
@@ -128,8 +128,8 @@
@.lua (let [[capacity transform] (:representation buffer)]
(table/concat [(transform (array.empty 0)) ""]))}
... default
- (row\fold (function (_ chunk total)
- (format total chunk))
- ""
- (:representation buffer)))))
+ (row\mix (function (_ chunk total)
+ (format total chunk))
+ ""
+ (:representation buffer)))))
))
diff --git a/stdlib/source/library/lux/data/text/encoding.lux b/stdlib/source/library/lux/data/text/encoding.lux
index fbe70b92d..b1947bf67 100644
--- a/stdlib/source/library/lux/data/text/encoding.lux
+++ b/stdlib/source/library/lux/data/text/encoding.lux
@@ -14,7 +14,6 @@
(template [<name> <encoding>]
[(`` (def: .public <name>
- {#.doc (example (~~ (template.text ["'" <encoding> "' text encoding. "])))}
Encoding
(:abstraction <encoding>)))]
diff --git a/stdlib/source/library/lux/data/text/encoding/utf8.lux b/stdlib/source/library/lux/data/text/encoding/utf8.lux
index 0adb95c82..e7d9b611c 100644
--- a/stdlib/source/library/lux/data/text/encoding/utf8.lux
+++ b/stdlib/source/library/lux/data/text/encoding/utf8.lux
@@ -24,8 +24,8 @@
... On Node
(ffi.import: Buffer
["#::."
- (#static from #as from|encode [ffi.String ffi.String] Buffer)
- (#static from #as from|decode [Uint8Array] Buffer)
+ (#static from #as from|encoded [ffi.String ffi.String] Buffer)
+ (#static from #as from|decoded [Uint8Array] Buffer)
(toString [ffi.String] ffi.String)])
... On the browser
@@ -62,7 +62,7 @@
(ffi.import: (utf8->string [Binary] Text)))}
(as_is)))
-(def: (encode value)
+(def: (encoded value)
(-> Text Binary)
(for {@.old
(java/lang/String::getBytes (//.name //.utf_8)
@@ -80,7 +80,7 @@
(:as Binary ("js object do" "getBytes" value ["utf8"]))
ffi.on_node_js?
- (|> (Buffer::from|encode [value "utf8"])
+ (|> (Buffer::from|encoded [value "utf8"])
... This coercion is valid as per NodeJS's documentation:
... https://nodejs.org/api/buffer.html#buffer_buffers_and_typedarrays
(:as Uint8Array))
@@ -111,7 +111,7 @@
@.scheme
(..string->utf8 value)}))
-(def: (decode value)
+(def: (decoded value)
(-> Binary (Try Text))
(with_expansions [<jvm> (#try.Success (java/lang/String::new value (//.name //.utf_8)))]
(for {@.old <jvm>
@@ -124,7 +124,7 @@
#try.Success)
ffi.on_node_js?
- (|> (Buffer::from|decode [value])
+ (|> (Buffer::from|decoded [value])
(Buffer::toString ["utf8"])
#try.Success)
@@ -158,8 +158,7 @@
#try.Success)})))
(implementation: .public codec
- {#.doc (example "A codec for binary encoding of text as UTF-8.")}
(Codec Binary Text)
- (def: encode ..encode)
- (def: decode ..decode))
+ (def: encoded ..encoded)
+ (def: decoded ..decoded))
diff --git a/stdlib/source/library/lux/data/text/escape.lux b/stdlib/source/library/lux/data/text/escape.lux
index dc847995a..4d99b6c8c 100644
--- a/stdlib/source/library/lux/data/text/escape.lux
+++ b/stdlib/source/library/lux/data/text/escape.lux
@@ -94,7 +94,7 @@
(def: (unicode_escaped char pre_offset pre_limit previous current)
(-> Char Nat Nat Text Text [Text Text Nat])
- (let [code (\ n.hex encode char)
+ (let [code (\ n.hex encoded char)
replacement (format ..sigil "u"
(case ("lux text size" code)
1 (format "000" code)
@@ -178,7 +178,7 @@
(-> Nat Text Text Nat (Try [Text Text Nat]))
(case (|> current
("lux text clip" (n.+ ..ascii_escape_offset offset) ..code_size)
- (\ n.hex decode))
+ (\ n.hex decoded))
(#try.Success char)
(let [limit' (|> limit (n.- offset) (n.- ..unicode_escape_offset))]
(#try.Success [(format previous
diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux
index de6482910..cd953ef05 100644
--- a/stdlib/source/library/lux/data/text/format.lux
+++ b/stdlib/source/library/lux/data/text/format.lux
@@ -56,35 +56,35 @@
(Format <type>)
<formatter>)]
- [bit Bit (\ bit.codec encode)]
- [nat Nat (\ nat.decimal encode)]
- [int Int (\ int.decimal encode)]
- [rev Rev (\ rev.decimal encode)]
- [frac Frac (\ frac.decimal encode)]
+ [bit Bit (\ bit.codec encoded)]
+ [nat Nat (\ nat.decimal encoded)]
+ [int Int (\ int.decimal encoded)]
+ [rev Rev (\ rev.decimal encoded)]
+ [frac Frac (\ frac.decimal encoded)]
[text Text text.format]
- [ratio ratio.Ratio (\ ratio.codec encode)]
- [name Name (\ name.codec encode)]
+ [ratio ratio.Ratio (\ ratio.codec encoded)]
+ [name Name (\ name.codec encoded)]
[location Location location.format]
[code Code code.format]
[type Type type.format]
- [instant instant.Instant (\ instant.codec encode)]
- [duration duration.Duration (\ duration.codec encode)]
- [date date.Date (\ date.codec encode)]
- [time time.Time (\ time.codec encode)]
- [day day.Day (\ day.codec encode)]
- [month month.Month (\ month.codec encode)]
+ [instant instant.Instant (\ instant.codec encoded)]
+ [duration duration.Duration (\ duration.codec encoded)]
+ [date date.Date (\ date.codec encoded)]
+ [time time.Time (\ time.codec encoded)]
+ [day day.Day (\ day.codec encoded)]
+ [month month.Month (\ month.codec encoded)]
- [xml xml.XML (\ xml.codec encode)]
- [json json.JSON (\ json.codec encode)]
+ [xml xml.XML (\ xml.codec encoded)]
+ [json json.JSON (\ json.codec encoded)]
)
(template [<type> <format>,<codec>]
[(`` (template [<format> <codec>]
[(def: .public <format>
(Format <type>)
- (\ <codec> encode))]
+ (\ <codec> encoded))]
(~~ (template.spliced <format>,<codec>))))]
@@ -113,7 +113,7 @@
(def: .public (mod modular)
(All [m] (Format (modular.Mod m)))
(let [codec (modular.codec (modular.modulus modular))]
- (\ codec encode modular)))
+ (\ codec encoded modular)))
(def: .public (list formatter)
(All [a] (-> (Format a) (Format (List a))))
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index 8c626ed6e..fa822c33b 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -14,7 +14,7 @@
[data
["." product]
[collection
- ["." list ("#\." fold monad)]]]
+ ["." list ("#\." mix monad)]]]
[macro (#+ with_identifiers)
[syntax (#+ syntax:)]
["." code]]
@@ -119,10 +119,10 @@
[_ (in [])
init re_user_class^'
rest (<>.some (<>.after (<text>.this "&&") (<text>.enclosed ["[" "]"] re_user_class^')))]
- (in (list\fold (function (_ refinement base)
- (` ((~! refine^) (~ refinement) (~ base))))
- init
- rest))))
+ (in (list\mix (function (_ refinement base)
+ (` ((~! refine^) (~ refinement) (~ base))))
+ init
+ rest))))
(def: blank^
(Parser Text)
@@ -195,7 +195,7 @@
(<>.either (do <>.monad
[_ (<text>.this "\")
id number^]
- (in (` ((~! ..copy) (~ (code.identifier ["" (n\encode id)]))))))
+ (in (` ((~! ..copy) (~ (code.identifier ["" (n\encoded id)]))))))
(do <>.monad
[_ (<text>.this "\k<")
captured_name name_part^
@@ -282,38 +282,38 @@
(re_scoped^ current_module)))
.let [g!total (code.identifier ["" "0total"])
g!temp (code.identifier ["" "0temp"])
- [_ names steps] (list\fold (: (-> (Either Code [Re_Group Code])
- [Nat (List Code) (List (List Code))]
- [Nat (List Code) (List (List Code))])
- (function (_ part [idx names steps])
- (case part
- (^or (#.Left complex) (#.Right [#Non_Capturing complex]))
- [idx
- names
- (list& (list g!temp complex
- (` .let) (` [(~ g!total) (\ (~! //.monoid) (~' compose) (~ g!total) (~ g!temp))]))
- steps)]
-
- (#.Right [(#Capturing [?name num_captures]) scoped])
- (let [[idx! name!] (case ?name
- (#.Some _name)
- [idx (code.identifier ["" _name])]
-
- #.None
- [(++ idx) (code.identifier ["" (n\encode idx)])])
- access (if (n.> 0 num_captures)
- (` ((~! product.left) (~ name!)))
- name!)]
- [idx!
- (list& name! names)
- (list& (list name! scoped
- (` .let) (` [(~ g!total) (\ (~! //.monoid) (~' compose) (~ g!total) (~ access))]))
- steps)])
- )))
- [0
- (: (List Code) (list))
- (: (List (List Code)) (list))]
- parts)]]
+ [_ names steps] (list\mix (: (-> (Either Code [Re_Group Code])
+ [Nat (List Code) (List (List Code))]
+ [Nat (List Code) (List (List Code))])
+ (function (_ part [idx names steps])
+ (case part
+ (^or (#.Left complex) (#.Right [#Non_Capturing complex]))
+ [idx
+ names
+ (list& (list g!temp complex
+ (` .let) (` [(~ g!total) (\ (~! //.monoid) (~' compose) (~ g!total) (~ g!temp))]))
+ steps)]
+
+ (#.Right [(#Capturing [?name num_captures]) scoped])
+ (let [[idx! name!] (case ?name
+ (#.Some _name)
+ [idx (code.identifier ["" _name])]
+
+ #.None
+ [(++ idx) (code.identifier ["" (n\encoded idx)])])
+ access (if (n.> 0 num_captures)
+ (` ((~! product.left) (~ name!)))
+ name!)]
+ [idx!
+ (list& name! names)
+ (list& (list name! scoped
+ (` .let) (` [(~ g!total) (\ (~! //.monoid) (~' compose) (~ g!total) (~ access))]))
+ steps)])
+ )))
+ [0
+ (: (List Code) (list))
+ (: (List (List Code)) (list))]
+ parts)]]
(in [(if capturing?
(list.size names)
0)
@@ -374,7 +374,7 @@
tail (<>.some (<>.after (<text>.this "|") sub^))]
(if (list.empty? tail)
(in head)
- (in [(list\fold n.max (product.left head) (list\map product.left tail))
+ (in [(list\mix n.max (product.left head) (list\map product.left tail))
(` ($_ ((~ (if capturing?
(` (~! |||^))
(` (~! |||_^)))))
diff --git a/stdlib/source/library/lux/data/text/unicode/set.lux b/stdlib/source/library/lux/data/text/unicode/set.lux
index be47d038a..ef489af08 100644
--- a/stdlib/source/library/lux/data/text/unicode/set.lux
+++ b/stdlib/source/library/lux/data/text/unicode/set.lux
@@ -5,7 +5,7 @@
[equivalence (#+ Equivalence)]]
[data
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
["." set ("#\." equivalence)]
["." tree #_
["#" finger (#+ Tree)]]]]
@@ -45,11 +45,11 @@
(def: .public (set [head tail])
(-> [Block (List Block)] Set)
- (list\fold (: (-> Block Set Set)
- (function (_ block set)
- (..composite (..singleton block) set)))
- (..singleton head)
- tail))
+ (list\mix (: (-> Block Set Set)
+ (function (_ block set)
+ (..composite (..singleton block) set)))
+ (..singleton head)
+ tail))
(def: character/0
Set
diff --git a/stdlib/source/library/lux/documentation.lux b/stdlib/source/library/lux/documentation.lux
index aca2b4e89..4768a1975 100644
--- a/stdlib/source/library/lux/documentation.lux
+++ b/stdlib/source/library/lux/documentation.lux
@@ -15,7 +15,7 @@
["." text (#+ \n) ("#\." order)
["%" format (#+ format)]]
[collection
- ["." list ("#\." monad fold monoid)]
+ ["." list ("#\." monad mix monoid)]
["." set (#+ Set)]]
[format
["md" markdown (#+ Markdown Block)]]]
@@ -60,14 +60,14 @@
[[[_ _ column] (<tag> members)]
(|> members
(list\map reference_column)
- (list\fold n.min column))])
+ (list\mix n.min column))])
([#.Form]
[#.Tuple])
[[_ _ column] (#.Record pairs)]
(|> (list\compose (list\map (|>> product.left reference_column) pairs)
(list\map (|>> product.right reference_column) pairs))
- (list\fold n.min column))
+ (list\mix n.min column))
))
(def: (padding reference_column [_ old_line old_column] [_ new_line new_column])
@@ -89,7 +89,7 @@
(function (_ [left right] tail)
(list& left right tail)))]
(|>> list.reversed
- (list\fold melded #.End))))
+ (list\mix melded #.End))))
(def: (code_documentation old_location reference_column example)
(-> Location Nat Code [Location Text])
@@ -111,11 +111,11 @@
(^template [|<| |>| <tag> <prep>]
[[group_location (<tag> members)]
- (let [[group_location' members_documentation] (list\fold (function (_ part [last_location text_accum])
- (let [[member_location member_documentation] (code_documentation last_location reference_column part)]
- [member_location (format text_accum member_documentation)]))
- [(revised@ #.column ++ group_location) ""]
- (<prep> members))]
+ (let [[group_location' members_documentation] (list\mix (function (_ part [last_location text_accum])
+ (let [[member_location member_documentation] (code_documentation last_location reference_column part)]
+ [member_location (format text_accum member_documentation)]))
+ [(revised@ #.column ++ group_location) ""]
+ (<prep> members))]
[(revised@ #.column ++ group_location')
(format (padding reference_column old_location group_location)
|<| members_documentation |>|)])])
@@ -279,7 +279,7 @@
(text\< (value@ #definition right)
(value@ #definition left))))
(list\map (value@ #documentation))
- (list\fold md.then md.empty)))
+ (list\mix md.then md.empty)))
(def: expected_separator
Text
@@ -287,11 +287,11 @@
(def: expected_format
(-> (List Text) Text)
- (list\fold (function (_ short aggregate)
- (case aggregate
- "" short
- _ (format aggregate ..expected_separator short)))
- ""))
+ (list\mix (function (_ short aggregate)
+ (case aggregate
+ "" short
+ _ (format aggregate ..expected_separator short)))
+ ""))
(def: expected
(-> Text (Set Text))
@@ -354,9 +354,9 @@
... Missing documentation
(case (|> module
(value@ #definitions)
- (list\fold (function (_ definition missing)
- (set.lacks (value@ #definition definition) missing))
- expected)
+ (list\mix (function (_ definition missing)
+ (set.lacks (value@ #definition definition) missing))
+ expected)
set.list)
#.End
md.empty
@@ -385,5 +385,5 @@
(text\< (value@ #module right) (value@ #module left))))
(list\map ..module_documentation)
(list.interposed md.horizontal_rule)
- (list\fold md.then (: (Markdown Block) md.empty))
+ (list\mix md.then (: (Markdown Block) md.empty))
md.markdown))
diff --git a/stdlib/source/library/lux/ffi.js.lux b/stdlib/source/library/lux/ffi.js.lux
index 65665bcd3..6d8ed9658 100644
--- a/stdlib/source/library/lux/ffi.js.lux
+++ b/stdlib/source/library/lux/ffi.js.lux
@@ -14,7 +14,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[type
abstract]
[macro (#+ with_identifiers)
diff --git a/stdlib/source/library/lux/ffi.jvm.lux b/stdlib/source/library/lux/ffi.jvm.lux
index a025b8108..16c4887ab 100644
--- a/stdlib/source/library/lux/ffi.jvm.lux
+++ b/stdlib/source/library/lux/ffi.jvm.lux
@@ -19,7 +19,7 @@
["%" format (#+ format)]]
[collection
["." array]
- ["." list ("#\." monad fold monoid)]
+ ["." list ("#\." monad mix monoid)]
["." dictionary (#+ Dictionary)]]]
[macro (#+ with_identifiers)
[syntax (#+ syntax:)]
@@ -71,7 +71,6 @@
(template [<name> <class>]
[(`` (def: .public <name>
- {#.doc (example (~~ (template.text ["The type of an (unboxed) " <name> " value."])))}
.Type
(#.Primitive (reflection.reflection <class>) #.End)))]
@@ -126,9 +125,6 @@
(template [<name> <op> <from> <to>]
[(template: .public (<name> value)
- {#.doc (example "Type converter."
- (: <to>
- (<name> (: <from> foo))))}
[(|> value
(: <from>)
"jvm object cast"
@@ -169,9 +165,6 @@
(template [<name> <from> <to> <0> <1>]
[(template: .public (<name> value)
- {#.doc (example "Type converter."
- (: <to>
- (<name> (: <from> foo))))}
[(|> value <0> <1>)])]
[long_to_char ..Long ..Character ..long_to_int ..int_to_char]
@@ -1098,7 +1091,7 @@
(case method_def
(#ConstructorMethod strict_fp? type_vars self_name arguments constructor_args body exs)
(let [replacer (|> (list\map (field->parser fully_qualified_class_name self_name) fields)
- (list\fold <>.either method_parser)
+ (list\mix <>.either method_parser)
parser->replacer)]
(` ("init"
(~ (privacy_modifier$ pm))
@@ -1114,7 +1107,7 @@
(#VirtualMethod final? strict_fp? type_vars self_name arguments return_type body exs)
(let [replacer (|> (list\map (field->parser fully_qualified_class_name self_name) fields)
- (list\fold <>.either method_parser)
+ (list\mix <>.either method_parser)
parser->replacer)]
(` ("virtual"
(~ (code.text name))
@@ -1131,7 +1124,7 @@
(#OverridenMethod strict_fp? declaration type_vars self_name arguments return_type body exs)
(let [replacer (|> (list\map (field->parser fully_qualified_class_name self_name) fields)
- (list\fold <>.either method_parser)
+ (list\mix <>.either method_parser)
parser->replacer)
super_replacer (parser->replacer (<code>.form (do <>.monad
[_ (<code>.this! (' ::super!))
@@ -1215,7 +1208,7 @@
method_parser (: (Parser Code)
(|> methods
(list\map (method->parser fully_qualified_class_name))
- (list\fold <>.either (<>.failure ""))))]]
+ (list\mix <>.either (<>.failure ""))))]]
(in (list (` ("jvm class"
(~ (declaration$ (type.declaration full_class_name class_vars)))
(~ (class$ super))
diff --git a/stdlib/source/library/lux/ffi.lua.lux b/stdlib/source/library/lux/ffi.lua.lux
index ddfeede9d..4d3f5aa26 100644
--- a/stdlib/source/library/lux/ffi.lua.lux
+++ b/stdlib/source/library/lux/ffi.lua.lux
@@ -15,7 +15,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[type
abstract]
[macro (#+ with_identifiers)
@@ -231,11 +231,11 @@
real_class (text.replaced "/" "." class)
imported (case (text.all_split_by "/" class)
(#.Item head tail)
- (list\fold (function (_ sub super)
- (` ("lua object get" (~ (code.text sub))
- (:as (..Object .Any) (~ super)))))
- (` ("lua import" (~ (code.text head))))
- tail)
+ (list\mix (function (_ sub super)
+ (` ("lua object get" (~ (code.text sub))
+ (:as (..Object .Any) (~ super)))))
+ (` ("lua import" (~ (code.text head))))
+ tail)
#.End
(` ("lua import" (~ (code.text class)))))]
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 9acf8e055..9ec503f1b 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -19,7 +19,7 @@
["%" format (#+ format)]]
[collection
["." array (#+ Array)]
- ["." list ("#\." monad fold monoid)]]]
+ ["." list ("#\." monad mix monoid)]]]
[macro (#+ with_identifiers)
[syntax (#+ syntax:)]
["." code]]
@@ -1067,7 +1067,7 @@
(with_parens
(spaced (list "init"
(privacy_modifier$ pm)
- (bit\encode strict_fp?)
+ (bit\encoded strict_fp?)
(with_brackets (spaced (list\map annotation$ anns)))
(with_brackets (spaced (list\map type_param$ type_vars)))
(with_brackets (spaced (list\map generic_type$ exs)))
@@ -1081,8 +1081,8 @@
(spaced (list "virtual"
name
(privacy_modifier$ pm)
- (bit\encode final?)
- (bit\encode strict_fp?)
+ (bit\encoded final?)
+ (bit\encoded strict_fp?)
(with_brackets (spaced (list\map annotation$ anns)))
(with_brackets (spaced (list\map type_param$ type_vars)))
(with_brackets (spaced (list\map generic_type$ exs)))
@@ -1106,7 +1106,7 @@
(spaced (list "override"
(class_decl$ class_decl)
name
- (bit\encode strict_fp?)
+ (bit\encoded strict_fp?)
(with_brackets (spaced (list\map annotation$ anns)))
(with_brackets (spaced (list\map type_param$ type_vars)))
(with_brackets (spaced (list\map generic_type$ exs)))
@@ -1124,7 +1124,7 @@
(spaced (list "static"
name
(privacy_modifier$ pm)
- (bit\encode strict_fp?)
+ (bit\encoded strict_fp?)
(with_brackets (spaced (list\map annotation$ anns)))
(with_brackets (spaced (list\map type_param$ type_vars)))
(with_brackets (spaced (list\map generic_type$ exs)))
@@ -1211,9 +1211,9 @@
.let [fully_qualified_class_name (format (safe current_module) "." full_class_name)
field_parsers (list\map (field_parser fully_qualified_class_name) fields)
method_parsers (list\map (method_parser (product.right class_decl) fully_qualified_class_name) methods)
- replacer (parser_replacer (list\fold <>.either
- (<>.failure "")
- (list\compose field_parsers method_parsers)))
+ replacer (parser_replacer (list\mix <>.either
+ (<>.failure "")
+ (list\compose field_parsers method_parsers)))
def_code (format "jvm class:"
(spaced (list (class_decl$ class_decl)
(super_class_decl$ super)
diff --git a/stdlib/source/library/lux/ffi.php.lux b/stdlib/source/library/lux/ffi.php.lux
index 112c0c0be..453f2c59e 100644
--- a/stdlib/source/library/lux/ffi.php.lux
+++ b/stdlib/source/library/lux/ffi.php.lux
@@ -15,7 +15,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[type
abstract]
[macro (#+ with_identifiers)
diff --git a/stdlib/source/library/lux/ffi.py.lux b/stdlib/source/library/lux/ffi.py.lux
index c4d8e1298..e3eea52e2 100644
--- a/stdlib/source/library/lux/ffi.py.lux
+++ b/stdlib/source/library/lux/ffi.py.lux
@@ -15,7 +15,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[type
abstract]
[macro (#+ with_identifiers)
@@ -251,11 +251,11 @@
real_class (text.replaced "/" "." class)
imported (case (text.all_split_by "/" class)
(#.Item head tail)
- (list\fold (function (_ sub super)
- (` ("python object get" (~ (code.text sub))
- (:as (..Object .Any) (~ super)))))
- (` ("python import" (~ (code.text head))))
- tail)
+ (list\mix (function (_ sub super)
+ (` ("python object get" (~ (code.text sub))
+ (:as (..Object .Any) (~ super)))))
+ (` ("python import" (~ (code.text head))))
+ tail)
#.End
(` ("python import" (~ (code.text class)))))]
diff --git a/stdlib/source/library/lux/ffi.rb.lux b/stdlib/source/library/lux/ffi.rb.lux
index 7175fe4c9..c01b88565 100644
--- a/stdlib/source/library/lux/ffi.rb.lux
+++ b/stdlib/source/library/lux/ffi.rb.lux
@@ -15,7 +15,7 @@
["." text
["%" format]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[type
abstract]
[macro (#+ with_identifiers)
diff --git a/stdlib/source/library/lux/ffi.scm.lux b/stdlib/source/library/lux/ffi.scm.lux
index c3b77f830..ab2e6cdff 100644
--- a/stdlib/source/library/lux/ffi.scm.lux
+++ b/stdlib/source/library/lux/ffi.scm.lux
@@ -15,7 +15,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[type
abstract]
[macro (#+ with_identifiers)
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index 8e11c4a58..cdd76278b 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -106,7 +106,7 @@
(do //.monad
[id //.seed]
(in (|> id
- (\ nat.decimal encode)
+ (\ nat.decimal encoded)
($_ text\compose "__gensym__" prefix)
[""] code.identifier))))
@@ -121,7 +121,7 @@
(def: .public wrong_syntax_error
(-> Name Text)
- (|>> name\encode
+ (|>> name\encoded
(text.prefix (text\compose "Wrong syntax for " text.\''))
(text.suffix (text\compose text.\'' "."))))
@@ -171,7 +171,7 @@
(do //.monad
[location //.location
output (<func> token)
- .let [_ ("lux io log" ($_ text\compose (name\encode macro_name) " " (location.format location)))
+ .let [_ ("lux io log" ($_ text\compose (name\encoded macro_name) " " (location.format location)))
_ (list\map (|>> code.format "lux io log")
output)
_ ("lux io log" "")]]
diff --git a/stdlib/source/library/lux/macro/code.lux b/stdlib/source/library/lux/macro/code.lux
index 79eebb5df..5de323722 100644
--- a/stdlib/source/library/lux/macro/code.lux
+++ b/stdlib/source/library/lux/macro/code.lux
@@ -9,7 +9,7 @@
["." name]
["." text ("#\." monoid equivalence)]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["." nat]
@@ -96,7 +96,7 @@
(case ast
(^template [<tag> <struct>]
[[_ (<tag> value)]
- (\ <struct> encode value)])
+ (\ <struct> encoded value)])
([#.Bit bit.codec]
[#.Nat nat.decimal]
[#.Int int.decimal]
@@ -108,19 +108,19 @@
(text.format value)
[_ (#.Tag name)]
- (text\compose "#" (\ name.codec encode name))
+ (text\compose "#" (\ name.codec encoded name))
(^template [<tag> <open> <close>]
[[_ (<tag> members)]
($_ text\compose
<open>
- (list\fold (function (_ next prev)
- (let [next (format next)]
- (if (text\= "" prev)
- next
- ($_ text\compose prev " " next))))
- ""
- members)
+ (list\mix (function (_ next prev)
+ (let [next (format next)]
+ (if (text\= "" prev)
+ next
+ ($_ text\compose prev " " next))))
+ ""
+ members)
<close>)])
([#.Form "(" ")"]
[#.Tuple "[" "]"])
@@ -128,18 +128,17 @@
[_ (#.Record pairs)]
($_ text\compose
"{"
- (list\fold (function (_ [left right] prev)
- (let [next ($_ text\compose (format left) " " (format right))]
- (if (text\= "" prev)
- next
- ($_ text\compose prev " " next))))
- ""
- pairs)
+ (list\mix (function (_ [left right] prev)
+ (let [next ($_ text\compose (format left) " " (format right))]
+ (if (text\= "" prev)
+ next
+ ($_ text\compose prev " " next))))
+ ""
+ pairs)
"}")
))
(def: .public (replaced original substitute ast)
- {#.doc "Replaces all code that looks like the 'original' with the 'substitute'."}
(-> Code Code Code Code)
(if (\ ..equivalence = original ast)
substitute
diff --git a/stdlib/source/library/lux/macro/template.lux b/stdlib/source/library/lux/macro/template.lux
index aac7af03c..aea5bfb5c 100644
--- a/stdlib/source/library/lux/macro/template.lux
+++ b/stdlib/source/library/lux/macro/template.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Utilities commonly used while templating."}
[library
[lux (#- let local)
["." meta]
@@ -69,11 +68,11 @@
full_tag
(<>.either <code>.local_tag
full_tag))
- (<>\map bit\encode <code>.bit)
- (<>\map nat\encode <code>.nat)
- (<>\map int\encode <code>.int)
- (<>\map rev\encode <code>.rev)
- (<>\map frac\encode <code>.frac)
+ (<>\map bit\encoded <code>.bit)
+ (<>\map nat\encoded <code>.nat)
+ (<>\map int\encoded <code>.int)
+ (<>\map rev\encoded <code>.rev)
+ (<>\map frac\encoded <code>.frac)
)))
(def: (part module_side?)
@@ -135,8 +134,8 @@
(exception: .public (irregular_arguments {expected Nat} {actual Nat})
(exception.report
- ["Expected" (\ nat.decimal encode expected)]
- ["Actual" (\ nat.decimal encode actual)]))
+ ["Expected" (\ nat.decimal encoded expected)]
+ ["Actual" (\ nat.decimal encoded actual)]))
(def: (macro (^slots [#parameters #template]))
(-> Local Macro)
diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux
index e088df673..a0a31472d 100644
--- a/stdlib/source/library/lux/math.lux
+++ b/stdlib/source/library/lux/math.lux
@@ -1,4 +1,4 @@
-(.module: {#.doc "Common mathematical constants and functions."}
+(.module:
[library
[lux #*
["@" target]
@@ -7,23 +7,22 @@
["n" nat]
["i" int]]]]])
-(template [<name> <value> <doc>]
+(template [<name> <value>]
[(def: .public <name>
- {#.doc <doc>}
<value>)]
- [e +2.7182818284590452354 "The base of the natural logarithm."]
+ [e +2.7182818284590452354]
... ["π is wrong!" by Bob Palais](https://www.math.utah.edu/~palais/pi.html)
- [pi +3.14159265358979323846 "The ratio of a circle's circumference to its diameter."]
+ [pi +3.14159265358979323846]
... [The Tau Manifesto](https://tauday.com/tau-manifesto)
- [tau +6.28318530717958647692 "The ratio of a circle's circumference to its radius."]
+ [tau +6.28318530717958647692]
)
(for {@.old
(as_is (template [<name> <method>]
- [(def: .public (<name> input)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (<method> input))]
+ (<method> it))]
[cos "jvm invokestatic:java.lang.Math:cos:double"]
[sin "jvm invokestatic:java.lang.Math:sin:double"]
@@ -285,10 +284,10 @@
(..pow ("lux f64 /" +3.0 +1.0))))
})
-(def: .public (round input)
+(def: .public (round it)
(-> Frac Frac)
- (let [floored (floor input)
- diff ("lux f64 -" floored input)]
+ (let [floored (floor it)
+ diff ("lux f64 -" floored it)]
(cond ("lux f64 <" diff +0.5)
("lux f64 +" +1.0 floored)
@@ -319,19 +318,19 @@
... ("lux f64 =" +0.0 y)
("lux f64 /" +0.0 +0.0))))
-(def: .public (log' base input)
+(def: .public (log' base it)
(-> Frac Frac Frac)
("lux f64 /"
(..log base)
- (..log input)))
+ (..log it)))
-(def: .public (factorial n)
+(def: .public (factorial it)
(-> Nat Nat)
(loop [acc 1
- n n]
- (if (n.<= 1 n)
+ it it]
+ (if (n.<= 1 it)
acc
- (recur (n.* n acc) (-- n)))))
+ (recur (n.* it acc) (-- it)))))
(def: .public (hypotenuse catA catB)
(-> Frac Frac Frac)
@@ -342,23 +341,23 @@
... Hyperbolic functions
... https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions
(template [<name> <comp> <inverse>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (|> (..exp x) (<comp> (..exp ("lux f64 *" -1.0 x))) ("lux f64 /" +2.0)))
+ (|> (..exp it) (<comp> (..exp ("lux f64 *" -1.0 it))) ("lux f64 /" +2.0)))
- (def: .public (<inverse> x)
+ (def: .public (<inverse> it)
(-> Frac Frac)
- (|> +2.0 ("lux f64 /" (|> (..exp x) (<comp> (..exp ("lux f64 *" -1.0 x)))))))]
+ (|> +2.0 ("lux f64 /" (|> (..exp it) (<comp> (..exp ("lux f64 *" -1.0 it)))))))]
[sinh "lux f64 -" csch]
[cosh "lux f64 +" sech]
)
(template [<name> <top> <bottom>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (let [e+ (exp x)
- e- (exp ("lux f64 *" -1.0 x))
+ (let [e+ (exp it)
+ e- (exp ("lux f64 *" -1.0 it))
sinh' (|> e+ ("lux f64 -" e-))
cosh' (|> e+ ("lux f64 +" e-))]
(|> <top> ("lux f64 /" <bottom>))))]
@@ -369,30 +368,30 @@
... https://en.wikipedia.org/wiki/Inverse_hyperbolic_functions#Definitions_in_terms_of_logarithms
(template [<name> <comp>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (|> x (pow +2.0) (<comp> +1.0) (pow +0.5) ("lux f64 +" x) log))]
+ (|> it (pow +2.0) (<comp> +1.0) (pow +0.5) ("lux f64 +" it) log))]
[asinh "lux f64 +"]
[acosh "lux f64 -"]
)
(template [<name> <base> <diff>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (let [x+ (|> <base> ("lux f64 +" <diff>))
- x- (|> <base> ("lux f64 -" <diff>))]
- (|> x+ ("lux f64 /" x-) log ("lux f64 /" +2.0))))]
+ (let [it+ (|> <base> ("lux f64 +" <diff>))
+ it- (|> <base> ("lux f64 -" <diff>))]
+ (|> it+ ("lux f64 /" it-) log ("lux f64 /" +2.0))))]
- [atanh +1.0 x]
- [acoth x +1.0]
+ [atanh +1.0 it]
+ [acoth it +1.0]
)
(template [<name> <op>]
- [(def: .public (<name> x)
+ [(def: .public (<name> it)
(-> Frac Frac)
- (let [x^2 (|> x (pow +2.0))]
- (|> +1.0 (<op> x^2) (pow +0.5) ("lux f64 +" +1.0) ("lux f64 /" x) log)))]
+ (let [it^2 (|> it (pow +2.0))]
+ (|> +1.0 (<op> it^2) (pow +0.5) ("lux f64 +" +1.0) ("lux f64 /" it) log)))]
[asech "lux f64 -"]
[acsch "lux f64 +"]
diff --git a/stdlib/source/library/lux/math/infix.lux b/stdlib/source/library/lux/math/infix.lux
index f63e86a4d..d2a210e7b 100644
--- a/stdlib/source/library/lux/math/infix.lux
+++ b/stdlib/source/library/lux/math/infix.lux
@@ -9,7 +9,7 @@
[data
["." product]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[macro
[syntax (#+ syntax:)]
["." code]]
@@ -50,21 +50,21 @@
init_op <code>.any
init_param expression
steps (<>.some (<>.and <code>.any expression))]
- (in (product.right (list\fold (function (_ [op param] [subject [_subject _op _param]])
- [param [(#Binary _subject _op _param)
- (` and)
- (#Binary subject op param)]])
- [init_param [init_subject init_op init_param]]
- steps))))
+ (in (product.right (list\mix (function (_ [op param] [subject [_subject _op _param]])
+ [param [(#Binary _subject _op _param)
+ (` and)
+ (#Binary subject op param)]])
+ [init_param [init_subject init_op init_param]]
+ steps))))
(do <>.monad
[init_subject expression
init_op <code>.any
init_param expression
steps (<>.some (<>.and <code>.any expression))]
- (in (list\fold (function (_ [op param] [_subject _op _param])
- [(#Binary _subject _op _param) op param])
- [init_subject init_op init_param]
- steps)))
+ (in (list\mix (function (_ [op param] [_subject _op _param])
+ [(#Binary _subject _op _param) op param])
+ [init_subject init_op init_param]
+ steps)))
))
)))
diff --git a/stdlib/source/library/lux/math/modular.lux b/stdlib/source/library/lux/math/modular.lux
index 5588ed574..9a94151c4 100644
--- a/stdlib/source/library/lux/math/modular.lux
+++ b/stdlib/source/library/lux/math/modular.lux
@@ -28,7 +28,7 @@
["#" modulus (#+ Modulus)]])
(abstract: .public (Mod m)
- {#.doc "A number under a modulus."}
+ {}
{#modulus (Modulus m)
#value Int}
@@ -50,8 +50,8 @@
(exception: .public [%] (incorrect_modulus {modulus (Modulus %)}
{parsed Int})
(exception.report
- ["Expected" (i\encode (//.divisor modulus))]
- ["Actual" (i\encode parsed)]))
+ ["Expected" (i\encoded (//.divisor modulus))]
+ ["Actual" (i\encoded parsed)]))
(def: separator
" mod ")
@@ -64,14 +64,14 @@
(implementation: .public (codec expected)
(All [%] (-> (Modulus %) (Codec Text (Mod %))))
- (def: (encode modular)
+ (def: (encoded modular)
(let [[_ value] (:representation modular)]
($_ text\compose
- (i\encode value)
+ (i\encoded value)
..separator
- (i\encode (//.divisor expected)))))
+ (i\encoded (//.divisor expected)))))
- (def: decode
+ (def: decoded
(<text>.result
(do <>.monad
[[value _ actual] ($_ <>.and intL (<text>.this ..separator) intL)
@@ -144,8 +144,8 @@
(exception: .public [r% s%] (moduli_are_not_equal {reference (Modulus r%)}
{subject (Modulus s%)})
(exception.report
- ["Reference" (i\encode (//.divisor reference))]
- ["Subject" (i\encode (//.divisor subject))]))
+ ["Reference" (i\encoded (//.divisor reference))]
+ ["Subject" (i\encoded (//.divisor subject))]))
(def: .public (adapter reference subject)
(All [r% s%]
diff --git a/stdlib/source/library/lux/math/modulus.lux b/stdlib/source/library/lux/math/modulus.lux
index 3c360bf60..f52210e24 100644
--- a/stdlib/source/library/lux/math/modulus.lux
+++ b/stdlib/source/library/lux/math/modulus.lux
@@ -21,8 +21,7 @@
(exception: .public zero_cannot_be_a_modulus)
(abstract: .public (Modulus %)
- {#.doc (example "A number used as a modulus in modular arithmetic."
- "It cannot be 0.")}
+ {}
Int
@@ -50,11 +49,6 @@
)
(syntax: .public (literal [divisor <code>.int])
- {#.doc (example "Success!"
- (literal 123)
-
- "Failure!"
- (literal 0))}
(meta.lifted
(do try.monad
[_ (..modulus divisor)]
diff --git a/stdlib/source/library/lux/math/number.lux b/stdlib/source/library/lux/math/number.lux
index 2f2259c18..03007c32e 100644
--- a/stdlib/source/library/lux/math/number.lux
+++ b/stdlib/source/library/lux/math/number.lux
@@ -13,22 +13,6 @@
["#." rev]
["#." frac]])
-(macro: (documentation tokens state)
- (case tokens
- (^ (list [location (#.Text encoding)] example_1 example_2))
- (let [encoding ($_ "lux text concat"
- "Given syntax for a "
- encoding
- " number, generates a Nat, an Int, a Rev or a Frac.")
- separators "Allows for the presence of commas among the digits."
- description [location (#.Text ($_ "lux text concat" encoding " " separators))]]
- (#try.Success [state (list (` (.example (~ description)
- (~ example_1)
- (~ example_2))))]))
-
- _
- (#try.Failure "Wrong syntax for 'documentation'.")))
-
(def: separator
",")
@@ -45,28 +29,27 @@
(-> Text Text)
(text.replaced ..separator ""))
-(template [<macro> <nat> <int> <rev> <frac> <error> <doc>]
+(template [<macro> <nat> <int> <rev> <frac> <error>]
[(macro: .public (<macro> tokens state)
- {#.doc <doc>}
(case tokens
(#.Item [meta (#.Text repr')] #.End)
(if (..separator_prefixed? repr')
(#try.Failure <error>)
(let [repr (..without_separators repr')]
- (case (\ <nat> decode repr)
+ (case (\ <nat> decoded repr)
(#try.Success value)
(#try.Success [state (list [meta (#.Nat value)])])
(^multi (#try.Failure _)
- {(\ <int> decode repr) (#try.Success value)})
+ {(\ <int> decoded repr) (#try.Success value)})
(#try.Success [state (list [meta (#.Int value)])])
(^multi (#try.Failure _)
- {(\ <rev> decode repr) (#try.Success value)})
+ {(\ <rev> decoded repr) (#try.Success value)})
(#try.Success [state (list [meta (#.Rev value)])])
(^multi (#try.Failure _)
- {(\ <frac> decode repr) (#try.Success value)})
+ {(\ <frac> decoded repr) (#try.Success value)})
(#try.Success [state (list [meta (#.Frac value)])])
_
@@ -75,13 +58,7 @@
_
(#try.Failure <error>)))]
- [bin /nat.binary /int.binary /rev.binary /frac.binary
- "Invalid binary syntax."
- (..documentation "binary" (bin "11001001") (bin "11,00,10,01"))]
- [oct /nat.octal /int.octal /rev.octal /frac.octal
- "Invalid octal syntax."
- (..documentation "octal" (oct "615243") (oct "615,243"))]
- [hex /nat.hex /int.hex /rev.hex /frac.hex
- "Invalid hexadecimal syntax."
- (..documentation "hexadecimal" (hex "deadBEEF") (hex "dead,BEEF"))]
+ [bin /nat.binary /int.binary /rev.binary /frac.binary "Invalid binary syntax."]
+ [oct /nat.octal /int.octal /rev.octal /frac.octal "Invalid octal syntax."]
+ [hex /nat.hex /int.hex /rev.hex /frac.hex "Invalid hexadecimal syntax."]
)
diff --git a/stdlib/source/library/lux/math/number/complex.lux b/stdlib/source/library/lux/math/number/complex.lux
index d26544c0b..324b84d43 100644
--- a/stdlib/source/library/lux/math/number/complex.lux
+++ b/stdlib/source/library/lux/math/number/complex.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Complex arithmetic."}
[library
[lux #*
["." math]
@@ -24,16 +23,11 @@
["." int]]]]])
(type: .public Complex
- {#.doc (example "A complex number.")}
{#real Frac
#imaginary Frac})
(syntax: .public (complex [real <code>.any
?imaginary (<>.maybe <code>.any)])
- {#.doc (example "Complex literals."
- (complex real imaginary)
- "The imaginary part can be omitted if it's +0.0."
- (complex real))}
(in (list (` {#..real (~ real)
#..imaginary (~ (maybe.else (' +0.0) ?imaginary))}))))
@@ -50,6 +44,7 @@
(..complex +0.0 +0.0))
(def: .public (not_a_number? complex)
+ (-> Complex Bit)
(or (f.not_a_number? (value@ #real complex))
(f.not_a_number? (value@ #imaginary complex))))
diff --git a/stdlib/source/library/lux/math/number/frac.lux b/stdlib/source/library/lux/math/number/frac.lux
index 1d92184b8..4e5eee846 100644
--- a/stdlib/source/library/lux/math/number/frac.lux
+++ b/stdlib/source/library/lux/math/number/frac.lux
@@ -23,28 +23,23 @@
["/#" //]])
(def: .public (= reference sample)
- {#.doc "Frac(tion) equivalence."}
(-> Frac Frac Bit)
("lux f64 =" reference sample))
(def: .public (< reference sample)
- {#.doc "Frac(tion) less-than."}
(-> Frac Frac Bit)
("lux f64 <" reference sample))
(def: .public (<= reference sample)
- {#.doc "Frac(tion) less-than or equal."}
(-> Frac Frac Bit)
(or ("lux f64 <" reference sample)
("lux f64 =" reference sample)))
(def: .public (> reference sample)
- {#.doc "Frac(tion) greater-than."}
(-> Frac Frac Bit)
("lux f64 <" sample reference))
(def: .public (>= reference sample)
- {#.doc "Frac(tion) greater-than or equal."}
(-> Frac Frac Bit)
(or ("lux f64 <" sample reference)
("lux f64 =" sample reference)))
@@ -59,17 +54,16 @@
[..= zero?]
)
-(template [<name> <op> <doc>]
+(template [<name> <op>]
[(def: .public (<name> param subject)
- {#.doc <doc>}
(-> Frac Frac Frac)
(<op> param subject))]
- [+ "lux f64 +" "Frac(tion) addition."]
- [- "lux f64 -" "Frac(tion) substraction."]
- [* "lux f64 *" "Frac(tion) multiplication."]
- [/ "lux f64 /" "Frac(tion) division."]
- [% "lux f64 %" "Frac(tion) remainder."]
+ [+ "lux f64 +"]
+ [- "lux f64 -"]
+ [* "lux f64 *"]
+ [/ "lux f64 /"]
+ [% "lux f64 %"]
)
(def: .public (/% param subject)
@@ -81,32 +75,31 @@
(-> Frac Frac)
(..* -1.0))
-(def: .public (abs x)
+(def: .public (abs it)
(-> Frac Frac)
- (if (..< +0.0 x)
- (..* -1.0 x)
- x))
+ (if (..< +0.0 it)
+ (..* -1.0 it)
+ it))
-(def: .public (signum x)
+(def: .public (signum it)
(-> Frac Frac)
- (cond (..= +0.0 x) +0.0
- (..< +0.0 x) -1.0
+ (cond (..= +0.0 it) +0.0
+ (..< +0.0 it) -1.0
... else
+1.0))
(def: min_exponent -1022)
(def: max_exponent (//int.frac +1023))
-(template [<name> <test> <doc>]
+(template [<name> <test>]
[(def: .public (<name> left right)
- {#.doc <doc>}
(-> Frac Frac Frac)
(if (<test> right left)
left
right))]
- [min ..< "Frac(tion) minimum."]
- [max ..> "Frac(tion) minimum."]
+ [min ..<]
+ [max ..>]
)
(def: .public nat
@@ -170,36 +163,33 @@
[maximum ..max (..* -1.0 ..biggest)]
)
-(template [<name> <numerator> <doc>]
+(template [<name> <numerator>]
[(def: .public <name>
- {#.doc <doc>}
Frac
(../ +0.0 <numerator>))]
- [not_a_number +0.0 "Not a number."]
- [positive_infinity +1.0 "Positive infinity."]
+ [not_a_number +0.0]
+ [positive_infinity +1.0]
)
(def: .public negative_infinity
- {#.doc "Negative infinity."}
Frac
(..* -1.0 ..positive_infinity))
-(def: .public (not_a_number? number)
- {#.doc "Tests whether a frac is actually not-a-number."}
+(def: .public (not_a_number? it)
(-> Frac Bit)
- (not (..= number number)))
+ (not (..= it it)))
-(def: .public (number? value)
+(def: .public (number? it)
(-> Frac Bit)
- (not (or (..not_a_number? value)
- (..= ..positive_infinity value)
- (..= ..negative_infinity value))))
+ (not (or (..not_a_number? it)
+ (..= ..positive_infinity it)
+ (..= ..negative_infinity it))))
(implementation: .public decimal
(Codec Text Frac)
- (def: (encode x)
+ (def: (encoded x)
(case x
-0.0 (let [output ("lux f64 encode" x)]
(if (text.starts_with? "-" output)
@@ -209,7 +199,7 @@
("lux f64 encode" x)
("lux text concat" "+" ("lux f64 encode" x)))))
- (def: (decode input)
+ (def: (decoded input)
(case ("lux f64 decode" [input])
(#.Some value)
(#try.Success value)
@@ -232,7 +222,7 @@
(template [<cast> <hex> <name>]
[(def: <name>
(|> <hex>
- (\ //nat.hex decode)
+ (\ //nat.hex decoded)
try.trusted
<cast>))]
@@ -247,19 +237,19 @@
(def: smallest_exponent
(..log/2 ..smallest))
-(def: .public (bits input)
+(def: .public (bits it)
(-> Frac I64)
- (.i64 (cond (..not_a_number? input)
+ (.i64 (cond (..not_a_number? it)
..not_a_number_bits
- (..= positive_infinity input)
+ (..= positive_infinity it)
..positive_infinity_bits
- (..= negative_infinity input)
+ (..= negative_infinity it)
..negative_infinity_bits
- (..= +0.0 input)
- (let [reciprocal (../ input +1.0)]
+ (..= +0.0 it)
+ (let [reciprocal (../ it +1.0)]
(if (..= positive_infinity reciprocal)
... Positive zero
..positive_zero_bits
@@ -267,11 +257,11 @@
..negative_zero_bits))
... else
- (let [sign_bit (if (..< -0.0 input)
+ (let [sign_bit (if (..< -0.0 it)
1
0)
- input (..abs input)
- exponent (|> input
+ it (..abs it)
+ exponent (|> it
..log/2
///.floor
(..min ..max_exponent))
@@ -280,7 +270,7 @@
(..+ (..min +0.0 min_gap))
(..- exponent))
max_gap (..- ..max_exponent power)
- mantissa (|> input
+ mantissa (|> it
(..* (///.pow (..min ..max_exponent power) +2.0))
(..* (if (..> +0.0 max_gap)
(///.pow max_gap +2.0)
@@ -310,11 +300,11 @@
[sign 1 ..sign_offset]
)
-(def: .public (of_bits input)
+(def: .public (of_bits it)
(-> I64 Frac)
- (case [(: Nat (..exponent input))
- (: Nat (..mantissa input))
- (: Nat (..sign input))]
+ (case [(: Nat (..exponent it))
+ (: Nat (..mantissa it))
+ (: Nat (..sign it))]
(^ [(static ..special_exponent_bits) 0 0])
..positive_infinity
@@ -362,7 +352,7 @@
after_length (//nat.- after_offset ("lux text size" representation))]
exponent (|> representation
("lux text clip" after_offset after_length)
- (\ codec decode))]
+ (\ codec decoded))]
(in [("lux text clip" 0 split_index representation)
(//int.* <factor> (.int exponent))]))])
([+1 (^or [(#.Some split_index) #.None #.None #.None]
@@ -377,7 +367,7 @@
[(implementation: .public <struct>
(Codec Text Frac)
- (def: (encode value)
+ (def: (encoded value)
(let [bits (..bits value)
mantissa (..mantissa bits)
exponent (//int.- (.int ..double_bias) (..exponent bits))
@@ -387,11 +377,11 @@
1 "-"
0 "+"
_ (undefined))
- (\ <nat> encode (.nat mantissa))
+ (\ <nat> encoded (.nat mantissa))
".0E"
- (\ <int> encode exponent))))
+ (\ <int> encoded exponent))))
- (def: (decode representation)
+ (def: (decoded representation)
(let [negative? (text.starts_with? "-" representation)
positive? (text.starts_with? "+" representation)]
(if (or negative? positive?)
@@ -404,16 +394,16 @@
after_length (//nat.- after_offset ("lux text size" mantissa))]
decimal (|> mantissa
("lux text clip" after_offset after_length)
- (\ <nat> decode))]
+ (\ <nat> decoded))]
(in [("lux text clip" 0 split_index mantissa)
decimal]))
#.None
(#try.Failure ("lux text concat" <error> representation)))
.let [whole ("lux text clip" 1 (-- ("lux text size" whole)) whole)]
- mantissa (\ <nat> decode (case decimal
- 0 whole
- _ ("lux text concat" whole (\ <nat> encode decimal))))
+ mantissa (\ <nat> decoded (case decimal
+ 0 whole
+ _ ("lux text concat" whole (\ <nat> encoded decimal))))
.let [sign (if negative? 1 0)]]
(in (..of_bits
($_ //i64.or
diff --git a/stdlib/source/library/lux/math/number/i16.lux b/stdlib/source/library/lux/math/number/i16.lux
index 59d067f31..9bbfc83a7 100644
--- a/stdlib/source/library/lux/math/number/i16.lux
+++ b/stdlib/source/library/lux/math/number/i16.lux
@@ -13,7 +13,6 @@
(maybe.trusted (i64.sub 16)))
(def: .public I16
- {#.doc (example "A 16-bit integer.")}
(:by_example [size]
(Sub size)
..sub
@@ -23,4 +22,4 @@
(def: .public equivalence (Equivalence I16) (\ ..sub &equivalence))
(def: .public width Nat (\ ..sub width))
(def: .public i16 (-> I64 I16) (\ ..sub narrow))
-(def: .public i64 (-> I16 I64) (\ ..sub widen))
+(def: .public i64 (-> I16 I64) (\ ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/i32.lux b/stdlib/source/library/lux/math/number/i32.lux
index 75e6c6ec3..63edd2244 100644
--- a/stdlib/source/library/lux/math/number/i32.lux
+++ b/stdlib/source/library/lux/math/number/i32.lux
@@ -13,7 +13,6 @@
(maybe.trusted (i64.sub 32)))
(def: .public I32
- {#.doc (example "A 32-bit integer.")}
(:by_example [size]
(Sub size)
..sub
@@ -23,4 +22,4 @@
(def: .public equivalence (Equivalence I32) (\ ..sub &equivalence))
(def: .public width Nat (\ ..sub width))
(def: .public i32 (-> I64 I32) (\ ..sub narrow))
-(def: .public i64 (-> I32 I64) (\ ..sub widen))
+(def: .public i64 (-> I32 I64) (\ ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux
index 42c08e00a..3f02cb4bd 100644
--- a/stdlib/source/library/lux/math/number/i64.lux
+++ b/stdlib/source/library/lux/math/number/i64.lux
@@ -21,37 +21,32 @@
(n.* ..bits_per_byte
..bytes_per_i64))
-(template [<parameter_type> <name> <op> <doc>]
+(template [<parameter_type> <name> <op>]
[(def: .public (<name> parameter subject)
- {#.doc <doc>}
(All [s] (-> <parameter_type> (I64 s) (I64 s)))
(<op> parameter subject))]
- [(I64 Any) or "lux i64 or" "Bitwise or."]
- [(I64 Any) xor "lux i64 xor" "Bitwise xor."]
- [(I64 Any) and "lux i64 and" "Bitwise and."]
+ [(I64 Any) or "lux i64 or"]
+ [(I64 Any) xor "lux i64 xor"]
+ [(I64 Any) and "lux i64 and"]
- [Nat left_shifted "lux i64 left-shift" "Bitwise left-shift."]
- [Nat right_shifted "lux i64 right-shift" "Unsigned/logic bitwise right-shift."]
+ [Nat left_shifted "lux i64 left-shift"]
+ [Nat right_shifted "lux i64 right-shift"]
)
... https://en.wikipedia.org/wiki/Mask_(computing)
(type: .public Mask
- {#.doc (example "A pattern of bits that can be imposed on I64 values.")}
I64)
(def: .public (bit position)
- {#.doc (example "A mask with only a specific bit set.")}
(-> Nat Mask)
(|> 1 .i64 (..left_shifted (n.% ..width position))))
(def: .public sign
- {#.doc (example "A mask for the sign bit of ints.")}
Mask
(..bit (-- ..width)))
(def: .public not
- {#.doc "Bitwise negation."}
(All [s] (-> (I64 s) (I64 s)))
(..xor (.i64 (-- 0))))
@@ -64,7 +59,6 @@
(..not ..false))
(def: .public (mask amount_of_bits)
- {#.doc (example "Mask a block of bits of the specified size.")}
(-> Nat Mask)
(case amount_of_bits
0 ..false
@@ -76,11 +70,10 @@
(-> Nat Nat Nat)
(|> value (right_shifted shift) (n.+ value)))
-(def: .public (ones subject)
- {#.doc "Count the number of 1s in a bit-map."}
+(def: .public (ones it)
(-> (I64 Any) Nat)
- (let [ones' (n.- (|> subject (right_shifted 1) (..and 6148914691236517205) i64)
- (i64 subject))]
+ (let [ones' (n.- (|> it (right_shifted 1) (..and 6148914691236517205) i64)
+ (i64 it))]
(|> ones'
(right_shifted 2) (..and 3689348814741910323) (n.+ (..and 3689348814741910323 ones'))
(with_shift 4) (..and 1085102592571150095)
@@ -90,18 +83,16 @@
(..and 127))))
(def: .public (zero index input)
- {#.doc "Clear bit at the given index."}
(All [s] (-> Nat (I64 s) (I64 s)))
(|> index ..bit ..not (..and input)))
-(template [<name> <op> <doc>]
+(template [<name> <op>]
[(def: .public (<name> index input)
- {#.doc <doc>}
(All [s] (-> Nat (I64 s) (I64 s)))
(|> index ..bit (<op> input)))]
- [one ..or "Set bit at given index."]
- [flipped ..xor "Flip bit at given index."]
+ [one ..or]
+ [flipped ..xor]
)
(def: .public (one? index input)
@@ -123,7 +114,6 @@
)
(def: .public (region offset size)
- {#.doc (example "A mask for a block of bits of the given size, starting at the given offset.")}
(-> Nat Nat Mask)
(..left_rotated offset (..mask size)))
@@ -169,7 +159,7 @@
(repetitions size "1")
(repetitions size "0")))
- high (try.trusted (\ n.binary decode pattern))
+ high (try.trusted (\ n.binary decoded pattern))
low (..right_rotated size high)]
(function (_ value)
(..or (..right_shifted size (..and high value))
@@ -189,8 +179,6 @@
swap/01)))
(interface: .public (Sub size)
- {#.doc (example "A sub-space of I64 with a reduce amount of bits.")}
-
(: (Equivalence (I64 size))
&equivalence)
(: Nat
@@ -198,10 +186,9 @@
(: (-> I64 (I64 size))
narrow)
(: (-> (I64 size) I64)
- widen))
+ wide))
(def: .public (sub width)
- {#.doc (example "Given a width in the interval (0,64), yields an implementation for integers of that width.")}
(Ex [size] (-> Nat (Maybe (Sub size))))
(if (.and (n.> 0 width)
(n.< ..width width))
@@ -216,7 +203,7 @@
(def: (narrow value)
(..or (|> value (..and ..sign) (..right_shifted sign_shift))
(|> value (..and mantissa))))
- (def: (widen value)
+ (def: (wide value)
(.i64 (case (.nat (..and sign value))
0 value
_ (..or co_mantissa value))))))))
diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux
index e0721117c..7fb3e8e8b 100644
--- a/stdlib/source/library/lux/math/number/i8.lux
+++ b/stdlib/source/library/lux/math/number/i8.lux
@@ -13,7 +13,6 @@
(maybe.trusted (i64.sub 8)))
(def: .public I8
- {#.doc (example "An 8-bit integer.")}
(:by_example [size]
(Sub size)
..sub
@@ -23,4 +22,4 @@
(def: .public equivalence (Equivalence I8) (\ ..sub &equivalence))
(def: .public width Nat (\ ..sub width))
(def: .public i8 (-> I64 I8) (\ ..sub narrow))
-(def: .public i64 (-> I8 I64) (\ ..sub widen))
+(def: .public i64 (-> I8 I64) (\ ..sub wide))
diff --git a/stdlib/source/library/lux/math/number/int.lux b/stdlib/source/library/lux/math/number/int.lux
index d5546a4a5..657780bd9 100644
--- a/stdlib/source/library/lux/math/number/int.lux
+++ b/stdlib/source/library/lux/math/number/int.lux
@@ -20,29 +20,24 @@
["#." i64]])
(def: .public (= reference sample)
- {#.doc "Int(eger) equivalence."}
(-> Int Int Bit)
("lux i64 =" reference sample))
(def: .public (< reference sample)
- {#.doc "Int(eger) less-than."}
(-> Int Int Bit)
("lux i64 <" reference sample))
(def: .public (<= reference sample)
- {#.doc "Int(eger) less-than or equal."}
(-> Int Int Bit)
(if ("lux i64 <" reference sample)
#1
("lux i64 =" reference sample)))
(def: .public (> reference sample)
- {#.doc "Int(eger) greater-than."}
(-> Int Int Bit)
("lux i64 <" sample reference))
(def: .public (>= reference sample)
- {#.doc "Int(eger) greater-than or equal."}
(-> Int Int Bit)
(if ("lux i64 <" sample reference)
#1
@@ -60,7 +55,6 @@
(template [<name> <test> <doc>]
[(def: .public (<name> left right)
- {#.doc <doc>}
(-> Int Int Int)
(if (<test> right left)
left
@@ -72,7 +66,6 @@
(template [<name> <op> <doc>]
[(def: .public (<name> param subject)
- {#.doc <doc>}
(-> Int Int Int)
(<op> param subject))]
@@ -84,35 +77,29 @@
)
(def: .public (/% param subject)
- {#.doc "Int(eger) [division remainder]."}
(-> Int Int [Int Int])
[(../ param subject)
(..% param subject)])
-(def: .public (opposite value)
- {#.doc (example "A value of equal magnitude and opposite sign.")}
+(def: .public (opposite it)
(-> Int Int)
- (..- value +0))
+ (..- it +0))
-(def: .public (abs x)
- {#.doc (example "A value of equal magnitude and positive sign.")}
+(def: .public (abs it)
(-> Int Int)
- (if (..< +0 x)
- (..* -1 x)
- x))
+ (if (..< +0 it)
+ (..* -1 it)
+ it))
-(def: .public (signum x)
- {#.doc (example "A value (either -1, 0 or +0) which represents the sign.")}
+(def: .public (signum it)
(-> Int Int)
- (cond (..= +0 x) +0
- (..< +0 x) -1
+ (cond (..= +0 it) +0
+ (..< +0 it) -1
... else
+1))
... https://rob.conery.io/2018/08/21/mod-and-remainder-are-not-the-same/
(def: .public (mod divisor dividend)
- {#.doc (example "Integer modulo."
- "Note: The modulo and the remainder are not the same.")}
(All [m] (-> Int Int Int))
(let [remainder (..% divisor dividend)]
(if (or (and (..< +0 divisor)
@@ -132,7 +119,6 @@
... https://en.wikipedia.org/wiki/Greatest_common_divisor
(def: .public (gcd a b)
- {#.doc "Greatest Common Divisor."}
(-> Int Int Int)
(case b
+0 a
@@ -144,7 +130,6 @@
... https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
(def: .public (extended_gcd a b)
- {#.doc "Extended euclidean algorithm."}
(-> Int Int [[Int Int] Int])
(loop [x +1 x1 +0
y +0 y1 +1
@@ -158,7 +143,6 @@
... https://en.wikipedia.org/wiki/Least_common_multiple
(def: .public (lcm a b)
- {#.doc "Least Common Multiple."}
(-> Int Int Int)
(case [a b]
(^or [_ +0] [+0 _])
@@ -223,25 +207,25 @@
[(implementation: .public <struct>
(Codec Text Int)
- (def: (encode value)
+ (def: (encoded value)
(if (..< +0 value)
- (|> value ++ ..opposite .nat ++ (\ <codec> encode) ("lux text concat" ..-sign))
- (|> value .nat (\ <codec> encode) ("lux text concat" ..+sign))))
+ (|> value ++ ..opposite .nat ++ (\ <codec> encoded) ("lux text concat" ..-sign))
+ (|> value .nat (\ <codec> encoded) ("lux text concat" ..+sign))))
- (def: (decode repr)
+ (def: (decoded repr)
(let [input_size ("lux text size" repr)]
(if (//nat.> 1 input_size)
(case ("lux text clip" 0 1 repr)
(^ (static ..+sign))
(|> repr
("lux text clip" 1 (-- input_size))
- (\ <codec> decode)
+ (\ <codec> decoded)
(\ try.functor map .int))
(^ (static ..-sign))
(|> repr
("lux text clip" 1 (-- input_size))
- (\ <codec> decode)
+ (\ <codec> decoded)
(\ try.functor map (|>> -- .int ..opposite --)))
_
@@ -261,7 +245,6 @@
(def: hash .nat))
(def: .public (right_shifted parameter subject)
- {#.doc "Signed/arithmetic bitwise right-shift."}
(-> Nat Int Int)
(//i64.or (//i64.and //i64.sign subject)
(//i64.right_shifted parameter subject)))
diff --git a/stdlib/source/library/lux/math/number/nat.lux b/stdlib/source/library/lux/math/number/nat.lux
index c72289e0d..2ec9333b7 100644
--- a/stdlib/source/library/lux/math/number/nat.lux
+++ b/stdlib/source/library/lux/math/number/nat.lux
@@ -14,15 +14,14 @@
["." maybe]
["." try (#+ Try)]]]])
-(template [<extension> <output> <name> <documentation>]
+(template [<extension> <output> <name>]
[(def: .public (<name> parameter subject)
- {#.doc <documentation>}
(-> Nat Nat <output>)
(<extension> parameter subject))]
- ["lux i64 =" Bit = "Nat(ural) equivalence."]
- ["lux i64 +" Nat + "Nat(ural) addition."]
- ["lux i64 -" Nat - "Nat(ural) substraction."]
+ ["lux i64 =" Bit =]
+ ["lux i64 +" Nat +]
+ ["lux i64 -" Nat -]
)
(def: high
@@ -35,7 +34,6 @@
(|>> ("lux i64 and" mask))))
(def: .public (< reference sample)
- {#.doc "Nat(ural) less-than."}
(-> Nat Nat Bit)
(let [referenceH (..high reference)
sampleH (..high sample)]
@@ -48,38 +46,33 @@
#0))))
(def: .public (<= reference sample)
- {#.doc "Nat(ural) less-than or equal."}
(-> Nat Nat Bit)
(if (..< reference sample)
#1
("lux i64 =" reference sample)))
(def: .public (> reference sample)
- {#.doc "Nat(ural) greater-than."}
(-> Nat Nat Bit)
(..< sample reference))
(def: .public (>= reference sample)
- {#.doc "Nat(ural) greater-than or equal."}
(-> Nat Nat Bit)
(if (..< sample reference)
#1
("lux i64 =" reference sample)))
-(template [<name> <test> <doc>]
+(template [<name> <test>]
[(def: .public (<name> left right)
- {#.doc <doc>}
(-> Nat Nat Nat)
(if (<test> right left)
left
right))]
- [min ..< "Nat(ural) minimum."]
- [max ..> "Nat(ural) maximum."]
+ [min ..<]
+ [max ..>]
)
(def: .public (* parameter subject)
- {#.doc "Nat(ural) multiplication."}
(-> Nat Nat Nat)
(:as Nat
("lux i64 *"
@@ -87,7 +80,6 @@
(:as Int subject))))
(def: .public (/ parameter subject)
- {#.doc "Nat(ural) division."}
(-> Nat Nat Nat)
(if ("lux i64 <" +0 (:as Int parameter))
(if (..< parameter subject)
@@ -106,7 +98,6 @@
("lux i64 +" 1 quotient)))))
(def: .public (/% parameter subject)
- {#.doc "Nat(ural) [division remainder]."}
(-> Nat Nat [Nat Nat])
(let [quotient (../ parameter subject)
flat ("lux i64 *"
@@ -115,7 +106,6 @@
[quotient ("lux i64 -" flat subject)]))
(def: .public (% parameter subject)
- {#.doc "Nat(ural) remainder."}
(-> Nat Nat Nat)
(let [flat ("lux i64 *"
(:as Int parameter)
@@ -123,7 +113,6 @@
("lux i64 -" flat subject)))
(def: .public (gcd a b)
- {#.doc "Greatest Common Divisor."}
(-> Nat Nat Nat)
(case b
0 a
@@ -134,7 +123,6 @@
(..= 1 (..gcd a b)))
(def: .public (lcm a b)
- {#.doc "Least Common Multiple."}
(-> Nat Nat Nat)
(case [a b]
(^or [_ 0] [0 _])
@@ -302,7 +290,7 @@
[(implementation: .public <struct>
(Codec Text Nat)
- (def: encode
+ (def: encoded
(let [mask (|> 1 ("lux i64 left-shift" <shift>) --)]
(function (_ value)
(loop [input value
@@ -317,7 +305,7 @@
input'
(recur input' output')))))))
- (def: (decode repr)
+ (def: (decoded repr)
(let [input_size ("lux text size" repr)]
(if (..> 0 input_size)
(loop [idx 0
@@ -343,7 +331,7 @@
(implementation: .public decimal
(Codec Text Nat)
- (def: (encode value)
+ (def: (encoded value)
(loop [input value
output ""]
(let [digit (decimal_character (..% 10 input))
@@ -355,7 +343,7 @@
input'
(recur input' output')))))
- (def: (decode repr)
+ (def: (decoded repr)
(let [input_size ("lux text size" repr)]
(with_expansions [<failure> (#try.Failure ("lux text concat" "Invalid decimal syntax for Nat: " repr))]
(if (..> 0 input_size)
diff --git a/stdlib/source/library/lux/math/number/ratio.lux b/stdlib/source/library/lux/math/number/ratio.lux
index 5d5962b47..6ab6d1349 100644
--- a/stdlib/source/library/lux/math/number/ratio.lux
+++ b/stdlib/source/library/lux/math/number/ratio.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Rational numbers."}
[library
[lux (#- nat)
[abstract
@@ -24,7 +23,6 @@
["n" nat ("#\." decimal)]])
(type: .public Ratio
- {#.doc (example "An unsigned ratio of numbers.")}
{#numerator Nat
#denominator Nat})
@@ -42,10 +40,6 @@
(syntax: .public (ratio [numerator <code>.any
?denominator (<>.maybe <code>.any)])
- {#.doc (example "Rational literals."
- (ratio numerator denominator)
- "The denominator can be omitted if it is 1."
- (ratio numerator))}
(in (list (` ((~! ..normal) {#..numerator (~ numerator)
#..denominator (~ (maybe.else (' 1) ?denominator))})))))
@@ -136,15 +130,15 @@
(implementation: .public codec
(Codec Text Ratio)
- (def: (encode (^slots [#numerator #denominator]))
- ($_ text\compose (n\encode numerator) ..separator (n\encode denominator)))
+ (def: (encoded (^slots [#numerator #denominator]))
+ ($_ text\compose (n\encoded numerator) ..separator (n\encoded denominator)))
- (def: (decode input)
+ (def: (decoded input)
(case (text.split_by ..separator input)
(#.Some [num denom])
(do try.monad
- [numerator (n\decode num)
- denominator (n\decode denom)]
+ [numerator (n\decoded num)
+ denominator (n\decoded denom)]
(in (normal {#numerator numerator
#denominator denominator})))
diff --git a/stdlib/source/library/lux/math/number/rev.lux b/stdlib/source/library/lux/math/number/rev.lux
index c7d5641ce..b4bf8bcd2 100644
--- a/stdlib/source/library/lux/math/number/rev.lux
+++ b/stdlib/source/library/lux/math/number/rev.lux
@@ -41,54 +41,47 @@
)
(def: .public (= reference sample)
- {#.doc "Rev(olution) equivalence."}
(-> Rev Rev Bit)
("lux i64 =" reference sample))
(def: .public (< reference sample)
- {#.doc "Rev(olution) less-than."}
(-> Rev Rev Bit)
(//nat.< (.nat reference) (.nat sample)))
(def: .public (<= reference sample)
- {#.doc "Rev(olution) less-than or equal."}
(-> Rev Rev Bit)
(if (//nat.< (.nat reference) (.nat sample))
true
("lux i64 =" reference sample)))
(def: .public (> reference sample)
- {#.doc "Rev(olution) greater-than."}
(-> Rev Rev Bit)
(..< sample reference))
(def: .public (>= reference sample)
- {#.doc "Rev(olution) greater-than or equal."}
(-> Rev Rev Bit)
(if (..< sample reference)
true
("lux i64 =" reference sample)))
-(template [<name> <test> <doc>]
+(template [<name> <test>]
[(def: .public (<name> left right)
- {#.doc <doc>}
(-> Rev Rev Rev)
(if (<test> right left)
left
right))]
- [min ..< "Rev(olution) minimum."]
- [max ..> "Rev(olution) maximum."]
+ [min ..<]
+ [max ..>]
)
-(template [<name> <op> <doc>]
+(template [<name> <op>]
[(def: .public (<name> param subject)
- {#.doc <doc>}
(-> Rev Rev Rev)
(<op> param subject))]
- [+ "lux i64 +" "Rev(olution) addition."]
- [- "lux i64 -" "Rev(olution) substraction."]
+ [+ "lux i64 +"]
+ [- "lux i64 -"]
)
(def: high
@@ -101,7 +94,6 @@
(|>> ("lux i64 and" mask))))
(def: .public (* param subject)
- {#.doc "Rev(olution) multiplication."}
(-> Rev Rev Rev)
(let [subjectH (..high subject)
subjectL (..low subject)
@@ -133,14 +125,12 @@
(with_expansions [<least_significant_bit> 1]
(def: .public (reciprocal numerator)
- {#.doc "Rev(olution) reciprocal of a Nat(ural)."}
(-> Nat Rev)
(.rev (case (: Nat ("lux i64 and" <least_significant_bit> numerator))
0 (..even_reciprocal numerator)
_ (..odd_reciprocal numerator))))
(def: .public (/ param subject)
- {#.doc "Rev(olution) division."}
(-> Rev Rev Rev)
(if ("lux i64 =" +0 param)
(panic! "Cannot divide Rev by zero!")
@@ -149,14 +139,13 @@
_ (..odd_reciprocal (.nat param)))]
(.rev (//nat.* reciprocal (.nat subject)))))))
-(template [<operator> <name> <output> <output_type> <documentation>]
+(template [<operator> <name> <output> <output_type>]
[(def: .public (<name> param subject)
- {#.doc <documentation>}
(-> Rev Rev <output_type>)
(<output> (<operator> (.nat param) (.nat subject))))]
- [//nat.% % .rev Rev "Rev(olution) remainder."]
- [//nat./ ratio |> Nat "Ratio between two rev(olution)s."]
+ [//nat.% % .rev Rev]
+ [//nat./ ratio |> Nat]
)
(template [<operator> <name>]
@@ -237,8 +226,8 @@
(implementation: .public <struct>
(Codec Text Rev)
- (def: (encode value)
- (let [raw_output (\ <codec> encode (.nat value))
+ (def: (encoded value)
+ (let [raw_output (\ <codec> encoded (.nat value))
max_num_chars (//nat.+ (//nat./ <char_bit_size> //i64.width)
(case (//nat.% <char_bit_size> //i64.width)
0 0
@@ -255,12 +244,12 @@
("lux text concat" zero_padding)
("lux text concat" "."))))
- (def: (decode repr)
+ (def: (decoded repr)
(let [repr_size ("lux text size" repr)]
(if (//nat.> 1 repr_size)
(case ("lux text char" 0 repr)
(^ (char "."))
- (case (\ <codec> decode (..decimals repr))
+ (case (\ <codec> decoded (..decimals repr))
(#try.Success output)
(#try.Success (.rev output))
@@ -340,7 +329,7 @@
(recur (-- idx)
false
("lux text concat"
- (\ //nat.decimal encode digit)
+ (\ //nat.decimal encoded digit)
output))))
(if all_zeroes?
"0"
@@ -412,7 +401,7 @@
(implementation: .public decimal
(Codec Text Rev)
- (def: (encode input)
+ (def: (encoded input)
(case (.nat input)
0
".0"
@@ -432,7 +421,7 @@
("lux text concat" "." (..format digits))
)))))
- (def: (decode input)
+ (def: (decoded input)
(let [dotted? (case ("lux text index" 0 "." input)
(#.Some 0)
true
diff --git a/stdlib/source/library/lux/math/random.lux b/stdlib/source/library/lux/math/random.lux
index 6b61b5159..3e9b14b8c 100644
--- a/stdlib/source/library/lux/math/random.lux
+++ b/stdlib/source/library/lux/math/random.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Pseudo-random number generation (PRNG) algorithms."}
[library
[lux (#- or and list i64 nat int rev char)
[abstract
@@ -12,7 +11,7 @@
["." unicode #_
["#" set]]]
[collection
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
["." array (#+ Array)]
["." dictionary (#+ Dictionary)]
["." queue (#+ Queue)]
@@ -39,11 +38,9 @@
[refinement (#+ Refiner Refined)]]]])
(type: .public #rec PRNG
- {#.doc "An abstract way to represent any PRNG."}
(-> Any [PRNG I64]))
(type: .public (Random a)
- {#.doc "A producer of random values based on a PRNG."}
(-> PRNG [PRNG a]))
(implementation: .public functor
@@ -59,7 +56,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ state)
(let [[state' f] (ff state)
[state'' a] (fa state')]
@@ -80,7 +77,6 @@
(fa state')))))
(def: .public (only pred gen)
- {#.doc "Retries the generator until the output satisfies a predicate."}
(All [a] (-> (-> a Bit) (Random a) (Random a)))
(do ..monad
[sample gen]
@@ -101,7 +97,6 @@
(one check random))))
(def: .public (refined refiner gen)
- {#.doc "Retries the generator until the output can be refined."}
(All [t r] (-> (Refiner t r) (Random t) (Random (Refined t r))))
(do ..monad
[sample gen]
@@ -142,7 +137,6 @@
(\ ..monad map (|>> .i64 f.of_bits) ..nat))
(def: .public safe_frac
- {#.doc (example "A number in the interval [0.0,1.0].")}
(Random Frac)
(let [mantissa_range (.int (i64.left_shifted 53 1))
mantissa_max (i.frac (-- mantissa_range))]
@@ -199,7 +193,6 @@
)
(def: .public (and left right)
- {#.doc "Sequencing combinator."}
(All [a b] (-> (Random a) (Random b) (Random [a b])))
(do ..monad
[=left left
@@ -207,7 +200,6 @@
(in [=left =right])))
(def: .public (or left right)
- {#.doc "Heterogeneous alternative combinator."}
(All [a b] (-> (Random a) (Random b) (Random (Or a b))))
(do {! ..monad}
[? bit]
@@ -220,7 +212,6 @@
(in (0 #1 =right))))))
(def: .public (either left right)
- {#.doc "Homogeneous alternative combinator."}
(All [a] (-> (Random a) (Random a) (Random a)))
(do ..monad
[? bit]
@@ -229,7 +220,6 @@
right)))
(def: .public (rec gen)
- {#.doc "A combinator for producing recursive random generators."}
(All [a] (-> (-> (Random a) (Random a)) (Random a)))
(function (_ state)
(let [gen' (gen (rec gen))]
@@ -268,7 +258,7 @@
[array Array array.of_list]
[queue Queue queue.of_list]
- [stack Stack (list\fold stack.top stack.empty)]
+ [stack Stack (list\mix stack.top stack.empty)]
)
(def: .public (set hash size value_gen)
@@ -355,8 +345,6 @@
(return state)])))
(def: .public (pcg_32 [increase seed])
- {#.doc (example "An implementation of the PCG32 algorithm."
- "For more information, please see: http://www.pcg-random.org/")}
(-> [(I64 Any) (I64 Any)] PRNG)
(let [magic 6364136223846793005]
(function (_ _)
@@ -370,8 +358,6 @@
.i64))])))
(def: .public (xoroshiro_128+ [s0 s1])
- {#.doc (example "An implementation of the Xoroshiro128+ algorithm."
- "For more information, please see: http://xoroshiro.di.unimi.it/")}
(-> [(I64 Any) (I64 Any)] PRNG)
(function (_ _)
[(let [s01 (i64.xor s0 s1)]
@@ -385,7 +371,6 @@
... https://en.wikipedia.org/wiki/Xorshift#Initialization
... http://xorshift.di.unimi.it/splitmix64.c
(def: .public split_mix_64
- {#.doc (example "An implementation of the SplitMix64 algorithm.")}
(-> Nat PRNG)
(let [twist (: (-> Nat Nat Nat)
(function (_ shift value)
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 0b4b809fc..13b7d9937 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc "Functions for extracting information from the state of the compiler."}
[library
[lux (#- type)
[abstract
@@ -46,7 +45,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ lux)
(case (ff lux)
(#try.Success [lux' f])
@@ -79,13 +78,10 @@
(ma lux')))))
(def: .public (result' lux action)
- {#.doc (example "Evaluates a computation that depends on Lux's compiler state."
- "Also returns a (potentially modified) compiler state.")}
(All [a] (-> Lux (Meta a) (Try [Lux a])))
(action lux))
(def: .public (result lux action)
- {#.doc (example "Evaluates a computation that depends on Lux's compiler state.")}
(All [a] (-> Lux (Meta a) (Try a)))
(case (action lux)
(#try.Failure error)
@@ -95,7 +91,6 @@
(#try.Success output)))
(def: .public (either left right)
- {#.doc "Pick whichever computation succeeds."}
(All [a] (-> (Meta a) (Meta a) (Meta a)))
(function (_ lux)
(case (left lux)
@@ -106,7 +101,6 @@
(#try.Success [lux' output]))))
(def: .public (assertion message test)
- {#.doc "Fails with the given message if the test is #0."}
(-> Text Bit (Meta Any))
(function (_ lux)
(if test
@@ -114,14 +108,12 @@
(#try.Failure message))))
(def: .public (failure error)
- {#.doc "Fails with the given error message."}
(All [a]
(-> Text (Meta a)))
(function (_ state)
(#try.Failure (location.with (value@ #.location state) error))))
(def: .public (module name)
- {#.doc (example "Looks-up a module with the given name.")}
(-> Text (Meta Module))
(function (_ lux)
(case (plist.value name (value@ #.modules lux))
@@ -132,7 +124,6 @@
(#try.Failure ($_ text\compose "Unknown module: " name)))))
(def: .public current_module_name
- {#.doc (example "The name of the module currently being compiled, if any.")}
(Meta Text)
(function (_ lux)
(case (value@ #.current_module lux)
@@ -143,7 +134,6 @@
(#try.Failure "No current module."))))
(def: .public current_module
- {#.doc (example "The module currently being compiled, if any.")}
(Meta Module)
(let [(^open "\.") ..monad]
(|> ..current_module_name
@@ -160,8 +150,6 @@
false)))
(def: .public (normal name)
- {#.doc (example "If given a name without a module prefix, gives it the current module's name as prefix."
- "Otherwise, returns the name as-is.")}
(-> Name (Meta Name))
(case name
["" name]
@@ -191,7 +179,6 @@
#.None))))
(def: .public (macro full_name)
- {#.doc (example "Looks-up a macro known by the given name.")}
(-> Name (Meta (Maybe Macro)))
(do ..monad
[[module name] (..normal full_name)]
@@ -206,9 +193,6 @@
(#try.Success [lux macro]))))))
(def: .public seed
- {#.doc (example "The current value of a number tracked by the compiler."
- "Also increases the value, so it's different next time it is seen."
- "This number can be used for generating data 'randomly' during compilation.")}
(Meta Nat)
(function (_ lux)
(#try.Success [(revised@ #.seed ++ lux)
@@ -260,7 +244,6 @@
(\ ..monad in type)))
(def: .public (var_type name)
- {#.doc "Looks-up the type of a local variable somewhere in the environment."}
(-> Text (Meta Type))
(function (_ lux)
(let [test (: (-> [Text [Type Any]] Bit)
@@ -301,7 +284,6 @@
(text.interposed ..listing_separator)))
(def: .public (definition name)
- {#.doc "Looks-up a definition's whole data in the available modules (including the current one)."}
(-> Name (Meta Global))
(do ..monad
[name (..normal name)
@@ -323,7 +305,7 @@
(list\map product.left)
..module_listing)]
(#try.Failure ($_ text\compose
- "Unknown definition: " (name\encode name) text.new_line
+ "Unknown definition: " (name\encoded name) text.new_line
" Current module: " current_module text.new_line
(case (plist.value current_module (value@ #.modules lux))
(#.Some this_module)
@@ -337,7 +319,7 @@
(#.Definition [exported? _ _ _])
(if (and exported?
(text\= normal_short def_name))
- (#.Some (name\encode [module_name def_name]))
+ (#.Some (name\encoded [module_name def_name]))
#.None)
(#.Alias _)
@@ -363,8 +345,6 @@
" All known modules: " all_known_modules text.new_line)))))))
(def: .public (export name)
- {#.doc (example "Looks-up a definition in the available modules (including the current one)."
- "The look-up only succeeds if the definition has been exported.")}
(-> Name (Meta Definition))
(do ..monad
[definition (..definition name)]
@@ -372,16 +352,15 @@
(#.Left de_aliased)
(failure ($_ text\compose
"Aliases are not considered exports: "
- (name\encode name)))
+ (name\encoded name)))
(#.Right definition)
(let [[exported? def_type def_data def_value] definition]
(if exported?
(in definition)
- (failure ($_ text\compose "Definition is not an export: " (name\encode name))))))))
+ (failure ($_ text\compose "Definition is not an export: " (name\encoded name))))))))
(def: .public (definition_type name)
- {#.doc "Looks-up a definition's type in the available modules (including the current one)."}
(-> Name (Meta Type))
(do ..monad
[definition (definition name)]
@@ -393,7 +372,6 @@
(clean_type def_type))))
(def: .public (type name)
- {#.doc "Looks-up the type of either a local variable or a definition."}
(-> Name (Meta Type))
(case name
["" _name]
@@ -404,7 +382,6 @@
(definition_type name)))
(def: .public (type_definition name)
- {#.doc "Finds the value of a type definition (such as Int, Any or Lux)."}
(-> Name (Meta Type))
(do ..monad
[definition (definition name)]
@@ -419,10 +396,9 @@
(type_code .Type)
(type_code def_type)))
(in (:as Type def_value))
- (..failure ($_ text\compose "Definition is not a type: " (name\encode name))))))))
+ (..failure ($_ text\compose "Definition is not a type: " (name\encoded name))))))))
(def: .public (globals module)
- {#.doc "The entire list of globals in a module (including the non-exported/private ones)."}
(-> Text (Meta (List [Text Global])))
(function (_ lux)
(case (plist.value module (value@ #.modules lux))
@@ -433,7 +409,6 @@
(#try.Success [lux (value@ #.definitions module)]))))
(def: .public (definitions module)
- {#.doc "The entire list of definitions in a module (including the non-exported/private ones)."}
(-> Text (Meta (List [Text Definition])))
(\ ..monad map
(list.all (function (_ [name global])
@@ -446,7 +421,6 @@
(..globals module)))
(def: .public (exports module_name)
- {#.doc "All the exported definitions in a module."}
(-> Text (Meta (List [Text Definition])))
(do ..monad
[constants (..definitions module_name)]
@@ -457,7 +431,6 @@
(list))))))
(def: .public modules
- {#.doc "All the available modules (including the current one)."}
(Meta (List [Text Module]))
(function (_ lux)
(|> lux
@@ -466,7 +439,6 @@
#try.Success)))
(def: .public (tags_of type_name)
- {#.doc "All the tags associated with a type definition."}
(-> Name (Meta (Maybe (List Name))))
(do ..monad
[.let [[module name] type_name]
@@ -479,13 +451,11 @@
(in #.None))))
(def: .public location
- {#.doc "The location of the current expression being analyzed."}
(Meta Location)
(function (_ lux)
(#try.Success [lux (value@ #.location lux)])))
(def: .public expected_type
- {#.doc "The expected type of the current expression being analyzed."}
(Meta Type)
(function (_ lux)
(case (value@ #.expected lux)
@@ -496,7 +466,6 @@
(#try.Failure "Not expecting any type."))))
(def: .public (imported_modules module_name)
- {#.doc "All the modules imported by a specified module."}
(-> Text (Meta (List Text)))
(do ..monad
[(^slots [#.imports]) (..module module_name)]
@@ -509,14 +478,12 @@
(in (list.any? (text\= import) imports))))
(def: .public (imported? import)
- {#.doc (example "Checks if the given module has been imported by the current module.")}
(-> Text (Meta Bit))
(\ ..functor map
(|>> (value@ #.imports) (list.any? (text\= import)))
..current_module))
(def: .public (tag tag_name)
- {#.doc "Given a tag, finds out what is its index, its related tag-list and its associated type."}
(-> Name (Meta [Nat (List Name) Type]))
(do ..monad
[.let [[module name] tag_name]
@@ -528,19 +495,18 @@
(if (or (text\= this_module_name module)
(and imported! exported?))
(in [idx tag_list type])
- (..failure ($_ text\compose "Cannot access tag: " (name\encode tag_name) " from module " this_module_name)))
+ (..failure ($_ text\compose "Cannot access tag: " (name\encoded tag_name) " from module " this_module_name)))
_
(..failure ($_ text\compose
- "Unknown tag: " (name\encode tag_name) text.new_line
+ "Unknown tag: " (name\encoded tag_name) text.new_line
" Known tags: " (|> =module
(value@ #.tags)
- (list\map (|>> product.left [module] name\encode (text.prefix text.new_line)))
+ (list\map (|>> product.left [module] name\encoded (text.prefix text.new_line)))
text.together)
)))))
(def: .public (tag_lists module)
- {#.doc "All the tag-lists defined in a module, with their associated types."}
(-> Text (Meta (List [(List Name) Type])))
(do ..monad
[=module (..module module)
@@ -553,7 +519,6 @@
[tag_list type]))))))
(def: .public locals
- {#.doc "All the local variables currently in scope, separated in different scopes."}
(Meta (List (List [Text Type])))
(function (_ lux)
(case (list.inits (value@ #.scopes lux))
@@ -568,7 +533,6 @@
scopes)]))))
(def: .public (de_aliased def_name)
- {#.doc "Given an aliased definition's name, returns the original definition being referenced."}
(-> Name (Meta Name))
(do ..monad
[constant (..definition def_name)]
@@ -580,13 +544,11 @@
def_name))))
(def: .public compiler_state
- {#.doc "Obtains the current state of the compiler."}
(Meta Lux)
(function (_ lux)
(#try.Success [lux lux])))
(def: .public type_context
- {#.doc (example "The current type-checking context.")}
(Meta Type_Context)
(function (_ lux)
(#try.Success [lux (value@ #.type_context lux)])))
diff --git a/stdlib/source/library/lux/meta/annotation.lux b/stdlib/source/library/lux/meta/annotation.lux
index 42d151df3..c73cc9247 100644
--- a/stdlib/source/library/lux/meta/annotation.lux
+++ b/stdlib/source/library/lux/meta/annotation.lux
@@ -1,5 +1,4 @@
(.module:
- {#.doc (.example "Machinary for querying annotations on modules and definitions.")}
[library
[lux (#- nat int rev)
[abstract
diff --git a/stdlib/source/library/lux/meta/location.lux b/stdlib/source/library/lux/meta/location.lux
index 24511eb26..f8d3a9023 100644
--- a/stdlib/source/library/lux/meta/location.lux
+++ b/stdlib/source/library/lux/meta/location.lux
@@ -19,8 +19,6 @@
#.column 0})
(macro: .public (here tokens compiler)
- {#.doc (example "The Location of the current form."
- (here))}
(case tokens
#.End
(let [location (value@ #.location compiler)]
@@ -33,15 +31,15 @@
_
(#.Left (`` (("lux in-module" (~~ (static .prelude_module)) wrong_syntax_error) (name_of ..here))))))
-(def: .public (format value)
+(def: .public (format it)
(-> Location Text)
(let [separator ","
- [file line column] value]
+ [file line column] it]
($_ "lux text concat"
"@"
- (`` (("lux in-module" (~~ (static .prelude_module)) .text\encode) file)) separator
- (`` (("lux in-module" (~~ (static .prelude_module)) .nat\encode) line)) separator
- (`` (("lux in-module" (~~ (static .prelude_module)) .nat\encode) column)))))
+ (`` (("lux in-module" (~~ (static .prelude_module)) .text\encoded) file)) separator
+ (`` (("lux in-module" (~~ (static .prelude_module)) .nat\encoded) line)) separator
+ (`` (("lux in-module" (~~ (static .prelude_module)) .nat\encoded) column)))))
(def: \n
("lux i64 char" +10))
diff --git a/stdlib/source/library/lux/target.lux b/stdlib/source/library/lux/target.lux
index 0821593ea..fca7b2f6c 100644
--- a/stdlib/source/library/lux/target.lux
+++ b/stdlib/source/library/lux/target.lux
@@ -3,8 +3,6 @@
[lux #*]])
(type: .public Target
- {#.doc (example "The name/ID of a platform targetted by a Lux compiler."
- "This information can be used to generate code targetting specific platforms, and to make programs cross-platform.")}
Text)
(template [<name> <value>]
diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux
index a53fac36f..3019924da 100644
--- a/stdlib/source/library/lux/target/common_lisp.lux
+++ b/stdlib/source/library/lux/target/common_lisp.lux
@@ -7,7 +7,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." monad fold monoid)]]]
+ ["." list ("#\." monad monoid)]]]
[macro
["." template]]
[math
diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux
index 191b5520a..b2af12ac2 100644
--- a/stdlib/source/library/lux/target/js.lux
+++ b/stdlib/source/library/lux/target/js.lux
@@ -7,7 +7,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
["." template]]
[math
@@ -427,10 +427,10 @@
(def: .public (cond clauses else!)
(-> (List [Expression Statement]) Statement Statement)
- (list\fold (.function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(template [<apply> <arg>+ <type>+ <function>+]
[(`` (def: .public (<apply> function)
diff --git a/stdlib/source/library/lux/target/jvm/attribute/code.lux b/stdlib/source/library/lux/target/jvm/attribute/code.lux
index 81f487d2d..265c951a2 100644
--- a/stdlib/source/library/lux/target/jvm/attribute/code.lux
+++ b/stdlib/source/library/lux/target/jvm/attribute/code.lux
@@ -9,7 +9,7 @@
[format
[".F" binary (#+ Writer) ("#\." monoid)]]
[collection
- ["." row (#+ Row) ("#\." functor fold)]]]
+ ["." row (#+ Row) ("#\." functor mix)]]]
[math
[number
["n" nat]]]]]
@@ -51,7 +51,7 @@
(|> code
(value@ #attributes)
(row\map length)
- (row\fold n.+ 0))))
+ (row\mix n.+ 0))))
(def: .public (equivalence attribute_equivalence)
(All [attribute]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode.lux b/stdlib/source/library/lux/target/jvm/bytecode.lux
index a97f4a1c2..9b16b5be6 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode.lux
@@ -17,7 +17,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." row (#+ Row)]]]
[macro
@@ -847,7 +847,7 @@
(in (let [@from (value@ #program_counter tracker)]
[[pool
environment'
- (|> (list\fold (..acknowledge_label actual) tracker (list& default at_minimum afterwards))
+ (|> (list\mix (..acknowledge_label actual) tracker (list& default at_minimum afterwards))
(with@ #program_counter program_counter'))]
[(function (_ resolver)
(let [get (: (-> Label (Maybe [Stack (Maybe Address)]))
@@ -890,7 +890,7 @@
(in (let [@from (value@ #program_counter tracker)]
[[pool
environment'
- (|> (list\fold (..acknowledge_label actual) tracker (list& default (list\map product.right cases)))
+ (|> (list\mix (..acknowledge_label actual) tracker (list& default (list\map product.right cases)))
(with@ #program_counter program_counter'))]
[(function (_ resolver)
(let [get (: (-> Label (Maybe [Stack (Maybe Address)]))
@@ -975,7 +975,7 @@
#//constant/pool.descriptor (type.descriptor type)})
.let [consumption (|> inputs
(list\map ..type_size)
- (list\fold n.+ (if <static?> 0 1))
+ (list\mix n.+ (if <static?> 0 1))
//unsigned.u1
try.trusted)
production (|> output ..type_size //unsigned.u1 try.trusted)]]
diff --git a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
index 43cb70e87..b1d51e164 100644
--- a/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
+++ b/stdlib/source/library/lux/target/jvm/bytecode/environment/limit/registry.lux
@@ -9,7 +9,7 @@
[format
[binary (#+ Writer)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]]]
@@ -45,7 +45,7 @@
(same? /////type.double input))
..wide
..normal)))
- (list\fold n.+ 0))))
+ (list\mix n.+ 0))))
(template [<start> <name>]
[(def: .public <name>
diff --git a/stdlib/source/library/lux/target/jvm/class.lux b/stdlib/source/library/lux/target/jvm/class.lux
index 586cc2394..0b792934b 100644
--- a/stdlib/source/library/lux/target/jvm/class.lux
+++ b/stdlib/source/library/lux/target/jvm/class.lux
@@ -73,12 +73,12 @@
[@this (//constant/pool.class this)
@super (//constant/pool.class super)
@interfaces (: (Resource (Row (Index //constant.Class)))
- (monad.fold ! (function (_ interface @interfaces)
- (do !
- [@interface (//constant/pool.class interface)]
- (in (row.suffix @interface @interfaces))))
- row.empty
- interfaces))]
+ (monad.mix ! (function (_ interface @interfaces)
+ (do !
+ [@interface (//constant/pool.class interface)]
+ (in (row.suffix @interface @interfaces))))
+ row.empty
+ interfaces))]
(in [@this @super @interfaces])))
(def: .public (class version modifier
diff --git a/stdlib/source/library/lux/target/jvm/constant/pool.lux b/stdlib/source/library/lux/target/jvm/constant/pool.lux
index 346dd0f9e..99597756d 100644
--- a/stdlib/source/library/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/library/lux/target/jvm/constant/pool.lux
@@ -14,7 +14,7 @@
["." format #_
["#" binary (#+ Writer) ("specification\." monoid)]]
[collection
- ["." row (#+ Row) ("#\." fold)]]]
+ ["." row (#+ Row) ("#\." mix)]]]
[macro
["." template]]
[math
@@ -147,10 +147,10 @@
(def: .public writer
(Writer Pool)
(function (_ [next pool])
- (row\fold (function (_ [_index post] pre)
- (specification\compose pre (//.writer post)))
- (format.bits/16 (!index next))
- pool)))
+ (row\mix (function (_ [_index post] pre)
+ (specification\compose pre (//.writer post)))
+ (format.bits/16 (!index next))
+ pool)))
(def: .public empty
Pool
diff --git a/stdlib/source/library/lux/target/jvm/reflection.lux b/stdlib/source/library/lux/target/jvm/reflection.lux
index db554e4fb..f23e3c019 100644
--- a/stdlib/source/library/lux/target/jvm/reflection.lux
+++ b/stdlib/source/library/lux/target/jvm/reflection.lux
@@ -14,7 +14,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
["." array]
["." dictionary]]]
[math
@@ -305,9 +305,9 @@
(|> params
(list.zipped/2 (list\map (|>> java/lang/reflect/TypeVariable::getName)
class_params))
- (list\fold (function (_ [name paramT] mapping)
- (dictionary.has name paramT mapping))
- /lux.fresh)
+ (list\mix (function (_ [name paramT] mapping)
+ (dictionary.has name paramT mapping))
+ /lux.fresh)
#try.Success)
(exception.except ..type_parameter_mismatch [num_class_params num_type_params class type]))
(exception.except ..cannot_correspond [class type])))
diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux
index b70cf80f0..8bac227eb 100644
--- a/stdlib/source/library/lux/target/lua.lux
+++ b/stdlib/source/library/lux/target/lua.lux
@@ -14,7 +14,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -96,7 +96,7 @@
(-> Int Literal)
... Integers must be turned into hexadecimal to avoid quirks in how Lua parses integers.
... In particular, the number -9223372036854775808 will be incorrectly parsed as a float by Lua.
- (.let [to_hex (\ n.hex encode)]
+ (.let [to_hex (\ n.hex encoded)]
(|>> .nat
to_hex
(format "0x")
@@ -366,10 +366,10 @@
(def: .public (cond clauses else!)
(-> (List [Expression Statement]) Statement Statement)
- (list\fold (.function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux
index 860c33713..4d9817ae4 100644
--- a/stdlib/source/library/lux/target/php.lux
+++ b/stdlib/source/library/lux/target/php.lux
@@ -14,7 +14,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -136,7 +136,7 @@
(def: .public int
(-> Int Literal)
- (.let [to_hex (\ n.hex encode)]
+ (.let [to_hex (\ n.hex encoded)]
(|>> .nat
to_hex
(format "0x")
@@ -537,10 +537,10 @@
(def: .public (cond clauses else!)
(-> (List [Expression Statement]) Statement Statement)
- (list\fold (function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(def: .public command_line_arguments
Var
diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux
index 06ad85593..47fbc7fdc 100644
--- a/stdlib/source/library/lux/target/python.lux
+++ b/stdlib/source/library/lux/target/python.lux
@@ -15,7 +15,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -452,10 +452,10 @@
(def: .public (cond clauses else!)
(-> (List [(Expression Any) (Statement Any)]) (Statement Any) (Statement Any))
- (list\fold (.function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
diff --git a/stdlib/source/library/lux/target/r.lux b/stdlib/source/library/lux/target/r.lux
index d5344a1c9..2b4fcede3 100644
--- a/stdlib/source/library/lux/target/r.lux
+++ b/stdlib/source/library/lux/target/r.lux
@@ -11,7 +11,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -264,10 +264,10 @@
(def: .public (cond clauses else)
(-> (List [Expression Expression]) Expression Expression)
- (list\fold (.function (_ [test then] next)
- (if test then next))
- else
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then] next)
+ (if test then next))
+ else
+ (list.reversed clauses)))
(template [<name> <op>]
[(def: .public (<name> param subject)
diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux
index 954a91d97..a63a15d09 100644
--- a/stdlib/source/library/lux/target/ruby.lux
+++ b/stdlib/source/library/lux/target/ruby.lux
@@ -14,7 +14,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[macro
[syntax (#+ syntax:)]
["." template]
@@ -428,10 +428,10 @@
(def: .public (cond clauses else!)
(-> (List [Expression Statement]) Statement Statement)
- (list\fold (.function (_ [test then!] next!)
- (..if test then! next!))
- else!
- (list.reversed clauses)))
+ (list\mix (.function (_ [test then!] next!)
+ (..if test then! next!))
+ else!
+ (list.reversed clauses)))
(syntax: (arity_inputs [arity <code>.nat])
(in (case arity
diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux
index 4390d9981..c91478519 100644
--- a/stdlib/source/library/lux/target/scheme.lux
+++ b/stdlib/source/library/lux/target/scheme.lux
@@ -11,7 +11,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold monoid)]]]
+ ["." list ("#\." functor monoid)]]]
[macro
["." template]]
[math
diff --git a/stdlib/source/library/lux/test.lux b/stdlib/source/library/lux/test.lux
index e92cd49e4..8df92c80a 100644
--- a/stdlib/source/library/lux/test.lux
+++ b/stdlib/source/library/lux/test.lux
@@ -23,7 +23,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set (#+ Set)]
["." dictionary #_
["#" ordered (#+ Dictionary)]]]]
@@ -312,11 +312,11 @@
(def: encoded_coverage
(-> (List Text) Text)
- (list\fold (function (_ short aggregate)
- (case aggregate
- "" short
- _ (format aggregate ..coverage_separator short)))
- ""))
+ (list\mix (function (_ short aggregate)
+ (case aggregate
+ "" short
+ _ (format aggregate ..coverage_separator short)))
+ ""))
(def: (coverage module encoding)
(-> Text Text (Set Name))
@@ -383,11 +383,11 @@
[.let [module (name.module module)]
definitions (meta.definitions module)
.let [coverage (|> definitions
- (list\fold (function (_ [short [exported? _]] aggregate)
- (if exported?
- (#.Item short aggregate)
- aggregate))
- #.End)
+ (list\mix (function (_ [short [exported? _]] aggregate)
+ (if exported?
+ (#.Item short aggregate)
+ aggregate))
+ #.End)
..encoded_coverage)]]
(in (list (` ((~! ..covering')
(~ (code.text module))
@@ -438,7 +438,7 @@
(list\map product.right))]
(write! [(|> assertions
(list\map product.left)
- (list\fold ..total ..start))
+ (list\mix ..total ..start))
(|> assertions
(list\map product.right)
(text.interposed ..separator))]))
diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux
index c6206e167..051012a8d 100644
--- a/stdlib/source/library/lux/time.lux
+++ b/stdlib/source/library/lux/time.lux
@@ -45,8 +45,8 @@
(exception: .public (time_exceeds_a_day {time Nat})
(exception.report
- ["Time (in milli-seconds)" (n\encode time)]
- ["Maximum (in milli-seconds)" (n\encode (-- limit))]))
+ ["Time (in milli-seconds)" (n\encoded time)]
+ ["Maximum (in milli-seconds)" (n\encoded (-- limit))]))
(def: separator ":")
@@ -64,9 +64,9 @@
(template [<maximum> <parser> <exception> <sub_parser>]
[(exception: .public (<exception> {value Nat})
(exception.report
- ["Value" (n\encode value)]
- ["Minimum" (n\encode 0)]
- ["Maximum" (n\encode (-- <maximum>))]))
+ ["Value" (n\encoded value)]
+ ["Minimum" (n\encoded 0)]
+ ["Maximum" (n\encoded (-- <maximum>))]))
(def: <parser>
(Parser Nat)
@@ -156,8 +156,8 @@
(def: (padded value)
(-> Nat Text)
(if (n.< 10 value)
- (text\compose "0" (n\encode value))
- (n\encode value)))
+ (text\compose "0" (n\encoded value))
+ (n\encoded value)))
(def: (positive space duration)
(-> Duration Duration Duration)
@@ -168,10 +168,10 @@
(def: (millis_format millis)
(-> Nat Text)
(cond (n.= 0 millis) ""
- (n.< 10 millis) ($_ text\compose ".00" (n\encode millis))
- (n.< 100 millis) ($_ text\compose ".0" (n\encode millis))
+ (n.< 10 millis) ($_ text\compose ".00" (n\encoded millis))
+ (n.< 100 millis) ($_ text\compose ".0" (n\encoded millis))
... (n.< 1,000 millis)
- ($_ text\compose "." (n\encode millis))))
+ ($_ text\compose "." (n\encoded millis))))
(type: .public Clock
{#.doc (example "A clock marking the specific hour, minute, second, and milli-second in a day.")}
@@ -219,5 +219,5 @@
"For example: 21:14:51.827")}
(Codec Text Time)
- (def: encode ..format)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..format)
+ (def: decoded (<text>.result ..parser)))
diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux
index d06910711..dd2cae8de 100644
--- a/stdlib/source/library/lux/time/date.lux
+++ b/stdlib/source/library/lux/time/date.lux
@@ -16,7 +16,7 @@
[data
["." text ("#\." monoid)]
[collection
- ["." list ("#\." fold)]
+ ["." list ("#\." mix)]
["." dictionary (#+ Dictionary)]]]
[math
[number
@@ -30,10 +30,10 @@
(def: month_by_number
(Dictionary Nat Month)
- (list\fold (function (_ month mapping)
- (dictionary.has (//month.number month) month mapping))
- (dictionary.empty n.hash)
- //month.year))
+ (list\mix (function (_ month mapping)
+ (dictionary.has (//month.number month) month mapping))
+ (dictionary.empty n.hash)
+ //month.year))
(def: minimum_day
1)
@@ -51,15 +51,15 @@
(exception: .public (invalid_day {year Year} {month Month} {day Nat})
(exception.report
- ["Value" (n\encode day)]
- ["Minimum" (n\encode ..minimum_day)]
- ["Maximum" (n\encode (..month_days year month))]
- ["Year" (\ //year.codec encode year)]
- ["Month" (n\encode (//month.number month))]))
+ ["Value" (n\encoded day)]
+ ["Minimum" (n\encoded ..minimum_day)]
+ ["Maximum" (n\encoded (..month_days year month))]
+ ["Year" (\ //year.codec encoded year)]
+ ["Month" (n\encoded (//month.number month))]))
(def: (padded value)
(-> Nat Text)
- (let [digits (n\encode value)]
+ (let [digits (n\encoded value)]
(if (n.< 10 value)
(text\compose "0" digits)
digits)))
@@ -155,9 +155,9 @@
(template [<minimum> <maximum> <parser> <exception>]
[(exception: .public (<exception> {value Nat})
(exception.report
- ["Value" (n\encode value)]
- ["Minimum" (n\encode <minimum>)]
- ["Maximum" (n\encode <maximum>)]))
+ ["Value" (n\encoded value)]
+ ["Minimum" (n\encoded <minimum>)]
+ ["Maximum" (n\encoded <maximum>)]))
(def: <parser>
(Parser Nat)
@@ -185,7 +185,7 @@
(def: (format value)
(-> Date Text)
($_ text\compose
- (\ //year.codec encode (..year value))
+ (\ //year.codec encoded (..year value))
..separator (..padded (|> value ..month //month.number))
..separator (..padded (..day_of_month value))))
@@ -194,8 +194,8 @@
"For example: 2017-01-15")}
(Codec Text Date)
- (def: encode ..format)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..format)
+ (def: decoded (<text>.result ..parser)))
(def: days_per_leap
(|> //year.days
diff --git a/stdlib/source/library/lux/time/day.lux b/stdlib/source/library/lux/time/day.lux
index b44ace3a8..e091d2d5b 100644
--- a/stdlib/source/library/lux/time/day.lux
+++ b/stdlib/source/library/lux/time/day.lux
@@ -98,7 +98,7 @@
(implementation: .public codec
(Codec Text Day)
- (def: (encode value)
+ (def: (encoded value)
(case value
(^template [<tag>]
[<tag> (template.text [<tag>])])
@@ -109,7 +109,7 @@
[#..Friday]
[#..Saturday]
[#..Sunday])))
- (def: (decode value)
+ (def: (decoded value)
(case value
(^template [<tag>]
[(^ (template.text [<tag>])) (#try.Success <tag>)])
@@ -149,11 +149,11 @@
(exception: .public (invalid_day {number Nat})
(exception.report
- ["Number" (\ n.decimal encode number)]
+ ["Number" (\ n.decimal encoded number)]
["Valid range" ($_ "lux text concat"
- (\ n.decimal encode (..number #Sunday))
+ (\ n.decimal encoded (..number #Sunday))
" ~ "
- (\ n.decimal encode (..number #Saturday)))]))
+ (\ n.decimal encoded (..number #Saturday)))]))
(def: .public (by_number number)
(-> Nat (Try Day))
diff --git a/stdlib/source/library/lux/time/duration.lux b/stdlib/source/library/lux/time/duration.lux
index 995d0c678..f36e0dff1 100644
--- a/stdlib/source/library/lux/time/duration.lux
+++ b/stdlib/source/library/lux/time/duration.lux
@@ -127,11 +127,11 @@
["-" negative_sign]
)
-(def: (encode duration)
+(def: (encoded duration)
(if (\ ..equivalence = ..empty duration)
($_ text\compose
..positive_sign
- (nat\encode 0)
+ (nat\encoded 0)
..milli_second_suffix)
(let [signed? (negative? duration)
[days time_left] [(ticks day duration) (framed day duration)]
@@ -147,11 +147,11 @@
millis (..millis time_left)]
($_ text\compose
(if signed? ..negative_sign ..positive_sign)
- (if (i.= +0 days) "" (text\compose (nat\encode (.nat days)) ..day_suffix))
- (if (i.= +0 hours) "" (text\compose (nat\encode (.nat hours)) ..hour_suffix))
- (if (i.= +0 minutes) "" (text\compose (nat\encode (.nat minutes)) ..minute_suffix))
- (if (i.= +0 seconds) "" (text\compose (nat\encode (.nat seconds)) ..second_suffix))
- (if (i.= +0 millis) "" (text\compose (nat\encode (.nat millis)) ..milli_second_suffix))
+ (if (i.= +0 days) "" (text\compose (nat\encoded (.nat days)) ..day_suffix))
+ (if (i.= +0 hours) "" (text\compose (nat\encoded (.nat hours)) ..hour_suffix))
+ (if (i.= +0 minutes) "" (text\compose (nat\encoded (.nat minutes)) ..minute_suffix))
+ (if (i.= +0 seconds) "" (text\compose (nat\encoded (.nat seconds)) ..second_suffix))
+ (if (i.= +0 millis) "" (text\compose (nat\encoded (.nat millis)) ..milli_second_suffix))
))))
(def: parser
@@ -186,8 +186,8 @@
(implementation: .public codec
(Codec Text Duration)
- (def: encode ..encode)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..encoded)
+ (def: decoded (<text>.result ..parser)))
(def: .public (difference from to)
(-> Duration Duration Duration)
diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux
index f454c1425..5b7b0e493 100644
--- a/stdlib/source/library/lux/time/instant.lux
+++ b/stdlib/source/library/lux/time/instant.lux
@@ -129,8 +129,8 @@
(let [[date time] (..date_time instant)
time (..clock_time time)]
($_ text\compose
- (\ date.codec encode date) ..date_suffix
- (\ //.codec encode time) ..time_suffix)))
+ (\ date.codec encoded date) ..date_suffix
+ (\ //.codec encoded time) ..time_suffix)))
(def: parser
(Parser Instant)
@@ -152,8 +152,8 @@
"For example: 2017-01-15T21:14:51.827Z")}
(Codec Text Instant)
- (def: encode ..format)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..format)
+ (def: decoded (<text>.result ..parser)))
(def: .public now
{#.doc (example "Yields the current instant, as measured from the operating-system's clock.")}
diff --git a/stdlib/source/library/lux/time/month.lux b/stdlib/source/library/lux/time/month.lux
index 07fcc6269..216365ac8 100644
--- a/stdlib/source/library/lux/time/month.lux
+++ b/stdlib/source/library/lux/time/month.lux
@@ -78,11 +78,11 @@
(exception: .public (invalid_month {number Nat})
(exception.report
- ["Number" (\ n.decimal encode number)]
+ ["Number" (\ n.decimal encoded number)]
["Valid range" ($_ "lux text concat"
- (\ n.decimal encode (..number #January))
+ (\ n.decimal encoded (..number #January))
" ~ "
- (\ n.decimal encode (..number #December)))]))
+ (\ n.decimal encoded (..number #December)))]))
(def: .public (by_number number)
(-> Nat (Try Month))
@@ -210,7 +210,7 @@
(implementation: .public codec
(Codec Text Month)
- (def: (encode value)
+ (def: (encoded value)
(case value
(^template [<tag>]
[<tag> (template.text [<tag>])])
@@ -226,7 +226,7 @@
[#..October]
[#..November]
[#..December])))
- (def: (decode value)
+ (def: (decoded value)
(case value
(^template [<tag>]
[(^ (template.text [<tag>])) (#try.Success <tag>)])
diff --git a/stdlib/source/library/lux/time/year.lux b/stdlib/source/library/lux/time/year.lux
index 3eb12ad90..4347aff81 100644
--- a/stdlib/source/library/lux/time/year.lux
+++ b/stdlib/source/library/lux/time/year.lux
@@ -112,12 +112,12 @@
))
(..with_year_0_leap year)))))
-(def: (encode year)
+(def: (encoded year)
(-> Year Text)
(let [year (..value year)]
(if (i.< +0 year)
- (i\encode year)
- (n\encode (.nat year)))))
+ (i\encoded year)
+ (n\encoded (.nat year)))))
(def: .public parser
(Parser Year)
@@ -134,8 +134,8 @@
"For example: 2017")}
(Codec Text Year)
- (def: encode ..encode)
- (def: decode (<text>.result ..parser)))
+ (def: encoded ..encoded)
+ (def: decoded (<text>.result ..parser)))
(implementation: .public equivalence
(Equivalence Year)
diff --git a/stdlib/source/library/lux/tool/compiler/default/platform.lux b/stdlib/source/library/lux/tool/compiler/default/platform.lux
index b5eed68f8..1894359a9 100644
--- a/stdlib/source/library/lux/tool/compiler/default/platform.lux
+++ b/stdlib/source/library/lux/tool/compiler/default/platform.lux
@@ -22,9 +22,9 @@
["%" format (#+ format)]]
[collection
["." dictionary (#+ Dictionary)]
- ["." row (#+ Row) ("#\." fold)]
+ ["." row (#+ Row) ("#\." mix)]
["." set (#+ Set)]
- ["." list ("#\." monoid functor fold)]]
+ ["." list ("#\." monoid functor mix)]]
[format
["_" binary (#+ Writer)]]]
[world
@@ -280,9 +280,9 @@
#///directive.state
#extension.state
#///generation.log])
- (row\fold (function (_ right left)
- (format left ..compilation_log_separator right))
- module)))
+ (row\mix (function (_ right left)
+ (format left ..compilation_log_separator right))
+ module)))
(def: with_reset_log
(All [<type_vars>]
@@ -329,10 +329,10 @@
(|> mapping
(dictionary.revised' source ..empty (set.has target))
(dictionary.revised source (set.union forward)))]
- (list\fold (function (_ previous)
- (dictionary.revised' previous ..empty (set.has target)))
- with_dependence+transitives
- (set.list backward))))))]
+ (list\mix (function (_ previous)
+ (dictionary.revised' previous ..empty (set.has target)))
+ with_dependence+transitives
+ (set.list backward))))))]
(|> dependence
(revised@ #depends_on
(update_dependence
@@ -561,17 +561,17 @@
... This currently assumes that all imports will be specified once in a single .module: form.
... This might not be the case in the future.
[all_dependencies duplicates _] (: [(Set Module) (Set Module) Bit]
- (list\fold (function (_ new [all duplicates seen_prelude?])
- (if (set.member? all new)
- (if (text\= .prelude_module new)
- (if seen_prelude?
- [all (set.has new duplicates) seen_prelude?]
- [all duplicates true])
- [all (set.has new duplicates) seen_prelude?])
- [(set.has new all) duplicates seen_prelude?]))
- (: [(Set Module) (Set Module) Bit]
- [all_dependencies ..empty (set.empty? all_dependencies)])
- new_dependencies))]
+ (list\mix (function (_ new [all duplicates seen_prelude?])
+ (if (set.member? all new)
+ (if (text\= .prelude_module new)
+ (if seen_prelude?
+ [all (set.has new duplicates) seen_prelude?]
+ [all duplicates true])
+ [all (set.has new duplicates) seen_prelude?])
+ [(set.has new all) duplicates seen_prelude?]))
+ (: [(Set Module) (Set Module) Bit]
+ [all_dependencies ..empty (set.empty? all_dependencies)])
+ new_dependencies))]
[archive state] (if (set.empty? duplicates)
(case new_dependencies
#.End
@@ -584,7 +584,7 @@
(monad.all ..monad))
.let [archive (|> archive,document+
(list\map product.left)
- (list\fold archive.merged archive))]]
+ (list\mix archive.merged archive))]]
(in [archive (try.trusted
(..updated_state archive state))])))
(async\in (exception.except ..cannot_import_twice [module duplicates])))]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
index 45216a70f..6d1f355ba 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -16,7 +16,7 @@
["." text ("#\." equivalence)
["%" format (#+ Format format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]
@@ -262,10 +262,10 @@
(def: .public (apply [abstraction inputs])
(-> (Application Analysis) Analysis)
- (list\fold (function (_ input abstraction')
- (#Apply input abstraction'))
- abstraction
- inputs))
+ (list\mix (function (_ input abstraction')
+ (#Apply input abstraction'))
+ abstraction
+ inputs))
(def: .public (application analysis)
(-> Analysis (Application Analysis))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
index fc7575260..6c31960e4 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case.lux
@@ -13,7 +13,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monoid functor)]]]
+ ["." list ("#\." mix monoid functor)]]]
[math
[number
["n" nat]]]
@@ -216,19 +216,19 @@
_
(undefined)))]
(do !
- [[memberP+ thenA] (list\fold (: (All [a]
- (-> [Type Code] (Operation [(List Pattern) a])
- (Operation [(List Pattern) a])))
- (function (_ [memberT memberC] then)
- (do !
- [[memberP [memberP+ thenA]] ((:as (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a])))
- analyse_pattern)
- #.None memberT memberC then)]
- (in [(list& memberP memberP+) thenA]))))
- (do !
- [nextA next]
- (in [(list) nextA]))
- matches)]
+ [[memberP+ thenA] (list\mix (: (All [a]
+ (-> [Type Code] (Operation [(List Pattern) a])
+ (Operation [(List Pattern) a])))
+ (function (_ [memberT memberC] then)
+ (do !
+ [[memberP [memberP+ thenA]] ((:as (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a])))
+ analyse_pattern)
+ #.None memberT memberC then)]
+ (in [(list& memberP memberP+) thenA]))))
+ (do !
+ [nextA next]
+ (in [(list) nextA]))
+ matches)]
(in [(/.pattern/tuple memberP+)
thenA])))
@@ -320,7 +320,7 @@
branchesT)
outputHC (|> outputH product.left /coverage.determine)
outputTC (monad.map ! (|>> product.left /coverage.determine) outputT)
- _ (.case (monad.fold try.monad /coverage.merged outputHC outputTC)
+ _ (.case (monad.mix try.monad /coverage.merged outputHC outputTC)
(#try.Success coverage)
(///.assertion non_exhaustive_pattern_matching [inputC branches coverage]
(/coverage.exhaustive? coverage))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
index e7efacf3c..753f6a13e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/case/coverage.lux
@@ -13,7 +13,7 @@
["." text
["%" format (#+ Format format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]]]
[math
[number
@@ -128,17 +128,17 @@
(#.Item lastP prevsP+)
(do ////.monad
[lastC (determine lastP)]
- (monad.fold ////.monad
- (function (_ leftP rightC)
- (do ////.monad
- [leftC (determine leftP)]
- (case rightC
- #Exhaustive
- (in leftC)
-
- _
- (in (#Seq leftC rightC)))))
- lastC prevsP+)))
+ (monad.mix ////.monad
+ (function (_ leftP rightC)
+ (do ////.monad
+ [leftC (determine leftP)]
+ (case rightC
+ #Exhaustive
+ (in leftC)
+
+ _
+ (in (#Seq leftC rightC)))))
+ lastC prevsP+)))
... Variant patterns can be shown to be exhaustive if all the possible
... cases are handled exhaustively.
@@ -243,17 +243,17 @@
... else
(do {! try.monad}
- [casesM (monad.fold !
- (function (_ [tagA coverageA] casesSF')
- (case (dictionary.value tagA casesSF')
- (#.Some coverageSF)
- (do !
- [coverageM (merged coverageA coverageSF)]
- (in (dictionary.has tagA coverageM casesSF')))
-
- #.None
- (in (dictionary.has tagA coverageA casesSF'))))
- casesSF (dictionary.entries casesA))]
+ [casesM (monad.mix !
+ (function (_ [tagA coverageA] casesSF')
+ (case (dictionary.value tagA casesSF')
+ (#.Some coverageSF)
+ (do !
+ [coverageM (merged coverageA coverageSF)]
+ (in (dictionary.has tagA coverageM casesSF')))
+
+ #.None
+ (in (dictionary.has tagA coverageA casesSF'))))
+ casesSF (dictionary.entries casesA))]
(in (if (and (or (known_cases? addition_cases)
(known_cases? so_far_cases))
(n.= (++ (n.max addition_cases so_far_cases))
@@ -360,9 +360,9 @@
#.None
(case (list.reversed possibilitiesSF)
(#.Item last prevs)
- (in (list\fold (function (_ left right) (#Alt left right))
- last
- prevs))
+ (in (list\mix (function (_ left right) (#Alt left right))
+ last
+ prevs))
#.End
(undefined)))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
index 8aa2f284f..3589b7224 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/function.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monoid monad)]]]
+ ["." list ("#\." monoid monad)]]]
["." type
["." check]]
["." meta]]]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
index 14e08a4c0..abe4b8df6 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/module.lux
@@ -11,7 +11,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
[dictionary
["." plist]]]]
["." meta]]]
@@ -264,10 +264,10 @@
(#try.Success [(revised@ #.modules
(plist.revised self_name
(|>> (revised@ #.tags (function (_ tag_bindings)
- (list\fold (function (_ [idx tag] table)
- (plist.has tag [idx namespaced_tags exported? type] table))
- tag_bindings
- (list.enumeration tags))))
+ (list\mix (function (_ [idx tag] table)
+ (plist.has tag [idx namespaced_tags exported? type] table))
+ tag_bindings
+ (list.enumeration tags))))
(revised@ #.types (plist.has type_name [namespaced_tags exported? type]))))
state)
[]]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
index 44d3b7deb..b859c7528 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/scope.lux
@@ -11,7 +11,7 @@
["." text ("#\." equivalence)]
["." product]
[collection
- ["." list ("#\." functor fold monoid)]
+ ["." list ("#\." functor mix monoid)]
[dictionary
["." plist]]]]]]
["." /// #_
@@ -90,17 +90,17 @@
(#.Item top_outer _)
(let [[ref_type init_ref] (maybe.else (undefined)
(..reference name top_outer))
- [ref inner'] (list\fold (: (-> Scope [Variable (List Scope)] [Variable (List Scope)])
- (function (_ scope ref+inner)
- [(#variable.Foreign (value@ [#.captured #.counter] scope))
- (#.Item (revised@ #.captured
- (: (-> Foreign Foreign)
- (|>> (revised@ #.counter ++)
- (revised@ #.mappings (plist.has name [ref_type (product.left ref+inner)]))))
- scope)
- (product.right ref+inner))]))
- [init_ref #.End]
- (list.reversed inner))
+ [ref inner'] (list\mix (: (-> Scope [Variable (List Scope)] [Variable (List Scope)])
+ (function (_ scope ref+inner)
+ [(#variable.Foreign (value@ [#.captured #.counter] scope))
+ (#.Item (revised@ #.captured
+ (: (-> Foreign Foreign)
+ (|>> (revised@ #.counter ++)
+ (revised@ #.mappings (plist.has name [ref_type (product.left ref+inner)]))))
+ scope)
+ (product.right ref+inner))]))
+ [init_ref #.End]
+ (list.reversed inner))
scopes (list\compose inner' outer)]
(#.Right [(with@ #.scopes scopes state)
(#.Some [ref_type ref])]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
index 886ffe065..b23704981 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/analysis/structure.lux
@@ -318,21 +318,21 @@
(/.except ..record_size_mismatch [size_ts size_record recordT record]))
.let [tuple_range (list.indices size_ts)
tag->idx (dictionary.of_list name.hash (list.zipped/2 tag_set tuple_range))]
- idx->val (monad.fold !
- (function (_ [key val] idx->val)
- (do !
- [key (///extension.lifted (meta.normal key))]
- (case (dictionary.value key tag->idx)
- (#.Some idx)
- (if (dictionary.key? idx->val idx)
- (/.except ..cannot_repeat_tag [key record])
- (in (dictionary.has idx val idx->val)))
-
- #.None
- (/.except ..tag_does_not_belong_to_record [key recordT]))))
- (: (Dictionary Nat Code)
- (dictionary.empty n.hash))
- record)
+ idx->val (monad.mix !
+ (function (_ [key val] idx->val)
+ (do !
+ [key (///extension.lifted (meta.normal key))]
+ (case (dictionary.value key tag->idx)
+ (#.Some idx)
+ (if (dictionary.key? idx->val idx)
+ (/.except ..cannot_repeat_tag [key record])
+ (in (dictionary.has idx val idx->val)))
+
+ #.None
+ (/.except ..tag_does_not_belong_to_record [key recordT]))))
+ (: (Dictionary Nat Code)
+ (dictionary.empty n.hash))
+ record)
.let [ordered_tuple (list\map (function (_ idx)
(maybe.trusted (dictionary.value idx idx->val)))
tuple_range)]]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
index 3c6425da3..98163f30d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/directive.lux
@@ -11,7 +11,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monoid)]]]]]
+ ["." list ("#\." mix monoid)]]]]]
["." // #_
["#." extension]
["#." analysis
@@ -101,7 +101,7 @@
_
(|> expansion
(monad.map ! (recur archive))
- (\ ! map (list\fold /.merge_requirements /.no_requirements)))))
+ (\ ! map (list\mix /.merge_requirements /.no_requirements)))))
_
(//.except ..not_a_directive code)))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
index 206ae9f64..18da2442f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension.lux
@@ -103,10 +103,10 @@
(-> Extender (Bundle s i o) (Operation s i o Any)))
(|> extensions
dictionary.entries
- (monad.fold //.monad
- (function (_ [extension handle] output)
- (..install extender extension handle))
- [])))
+ (monad.mix //.monad
+ (function (_ [extension handle] output)
+ (..install extender extension handle))
+ [])))
(def: .public (apply archive phase [name parameters])
(All [s i o]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
index 508242cd8..d4ffdbb2b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis/jvm.lux
@@ -18,7 +18,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." fold monad monoid)]
+ ["." list ("#\." mix monad monoid)]
["." array]
["." dictionary (#+ Dictionary)]]]
[math
@@ -1110,20 +1110,20 @@
true)
arity_matches? (n.= (list.size inputsJT) (list.size parameters))
inputs_match? (and arity_matches?
- (list\fold (function (_ [expectedJC actualJC] prev)
- (and prev
- (jvm\= expectedJC (: (Type Value)
- (case (jvm_parser.var? actualJC)
- (#.Some name)
- (|> aliasing
- (dictionary.value name)
- (maybe.else name)
- jvm.var)
-
- #.None
- actualJC)))))
- true
- (list.zipped/2 parameters inputsJT)))]]
+ (list\mix (function (_ [expectedJC actualJC] prev)
+ (and prev
+ (jvm\= expectedJC (: (Type Value)
+ (case (jvm_parser.var? actualJC)
+ (#.Some name)
+ (|> aliasing
+ (dictionary.value name)
+ (maybe.else name)
+ jvm.var)
+
+ #.None
+ actualJC)))))
+ true
+ (list.zipped/2 parameters inputsJT)))]]
(in (and correct_class?
correct_method?
static_matches?
@@ -1685,7 +1685,7 @@
[scope bodyA] (|> arguments'
(#.Item [self_name selfT])
list.reversed
- (list\fold scope.with_local (analyse archive body))
+ (list\mix scope.with_local (analyse archive body))
(typeA.with_type .Any)
/////analysis.with_scope)]
(in (/////analysis.tuple (list (/////analysis.text ..constructor_tag)
@@ -1761,7 +1761,7 @@
[scope bodyA] (|> arguments'
(#.Item [self_name selfT])
list.reversed
- (list\fold scope.with_local (analyse archive body))
+ (list\mix scope.with_local (analyse archive body))
(typeA.with_type returnT)
/////analysis.with_scope)]
(in (/////analysis.tuple (list (/////analysis.text ..virtual_tag)
@@ -1834,7 +1834,7 @@
arguments)
[scope bodyA] (|> arguments'
list.reversed
- (list\fold scope.with_local (analyse archive body))
+ (list\mix scope.with_local (analyse archive body))
(typeA.with_type returnT)
/////analysis.with_scope)]
(in (/////analysis.tuple (list (/////analysis.text ..static_tag)
@@ -1930,19 +1930,19 @@
check.existential)]
(in [var exT])))
vars)]
- (in (list\fold (function (_ [varJ varT] mapping)
- (dictionary.has (jvm_parser.name varJ) varT mapping))
- mapping
- pairings))))
+ (in (list\mix (function (_ [varJ varT] mapping)
+ (dictionary.has (jvm_parser.name varJ) varT mapping))
+ mapping
+ pairings))))
(def: .public (with_override_mapping supers parent_type mapping)
(-> (List (Type Class)) (Type Class) Mapping (Operation Mapping))
(do phase.monad
[override_mapping (..override_mapping mapping supers parent_type)]
- (in (list\fold (function (_ [super_var bound_type] mapping)
- (dictionary.has super_var bound_type mapping))
- mapping
- override_mapping))))
+ (in (list\mix (function (_ [super_var bound_type] mapping)
+ (dictionary.has super_var bound_type mapping))
+ mapping
+ override_mapping))))
(def: .public (hide_method_body arity bodyA)
(-> Nat Analysis Analysis)
@@ -2001,7 +2001,7 @@
[scope bodyA] (|> arguments'
(#.Item [self_name selfT])
list.reversed
- (list\fold scope.with_local (analyse archive body))
+ (list\mix scope.with_local (analyse archive body))
(typeA.with_type returnT)
/////analysis.with_scope)]
(in (/////analysis.tuple (list (/////analysis.text ..overriden_tag)
@@ -2066,14 +2066,14 @@
(n.= (list.size expected_parameters)
(list.size actual_parameters)))]
(in (|> (list.zipped/2 expected_parameters actual_parameters)
- (list\fold (function (_ [expected actual] mapping)
- (case (jvm_parser.var? actual)
- (#.Some actual)
- (dictionary.has actual expected mapping)
-
- #.None
- mapping))
- jvm_alias.fresh)))))
+ (list\mix (function (_ [expected actual] mapping)
+ (case (jvm_parser.var? actual)
+ (#.Some actual)
+ (dictionary.has actual expected mapping)
+
+ #.None
+ mapping))
+ jvm_alias.fresh)))))
(def: (anonymous_class_name module id)
(-> Module Nat Text)
@@ -2125,12 +2125,12 @@
_ (monad.map ! (|>> ..reflection (..ensure_fresh_class! class_loader)) super_interfaces)
parameters (typeA.with_env
(..parameter_types parameters))
- .let [mapping (list\fold (function (_ [parameterJ parameterT] mapping)
- (dictionary.has (jvm_parser.name parameterJ)
- parameterT
- mapping))
- luxT.fresh
- parameters)]
+ .let [mapping (list\mix (function (_ [parameterJ parameterT] mapping)
+ (dictionary.has (jvm_parser.name parameterJ)
+ parameterT
+ mapping))
+ luxT.fresh
+ parameters)]
super_classT (typeA.with_env
(luxT.check (luxT.class mapping) (..signature super_class)))
super_interfaceT+ (typeA.with_env
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
index 0242d94b6..29de45227 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/directive/jvm.lux
@@ -14,7 +14,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary]
["." row]]]
[macro
@@ -263,10 +263,10 @@
[parameters (directive.lifted_analysis
(typeA.with_env
(jvm.parameter_types parameters)))
- .let [mapping (list\fold (function (_ [parameterJ parameterT] mapping)
- (dictionary.has (parser.name parameterJ) parameterT mapping))
- luxT.fresh
- parameters)]
+ .let [mapping (list\mix (function (_ [parameterJ parameterT] mapping)
+ (dictionary.has (parser.name parameterJ) parameterT mapping))
+ luxT.fresh
+ parameters)]
super_classT (directive.lifted_analysis
(typeA.with_env
(luxT.check (luxT.class mapping) (..signature super_class))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
index e8518812e..49b696138 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/common_lisp/common.lux
@@ -15,7 +15,7 @@
[collection
["." dictionary]
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -75,7 +75,7 @@
... branchG])))
... conditionals))]
... (in (_.let (list [@input inputG])
-... (list (list\fold (function (_ [test then] else)
+... (list (list\mix (function (_ [test then] else)
... (_.if test then else))
... elseG
... conditionalsG))))))]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
index 0e0c91e60..142691489 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/lua/common.lux
@@ -14,7 +14,7 @@
["%" format (#+ format)]]
[collection
["." dictionary]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -70,18 +70,18 @@
[branchG (phase archive branch)]
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
- (list\fold (function (_ clause total)
- (if (same? _.nil total)
- clause
- (_.or clause total)))
- _.nil))
+ (list\mix (function (_ clause total)
+ (if (same? _.nil total)
+ clause
+ (_.or clause total)))
+ _.nil))
branchG])))
conditionals))
.let [closure (_.closure (list @input)
- (list\fold (function (_ [test then] else)
- (_.if test (_.return then) else))
- (_.return elseG)
- conditionalsG))]]
+ (list\mix (function (_ [test then] else)
+ (_.if test (_.return then) else))
+ (_.return elseG)
+ conditionalsG))]]
(in (_.apply/1 closure inputG))))]))
(def: lux_procs
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
index 02ddfbd71..3acac79be 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/php/common.lux
@@ -15,7 +15,7 @@
[collection
["." dictionary]
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -74,11 +74,11 @@
[branchG (phase archive branch)]
(in [(|> chars
(list\map (|>> .int _.int (_.=== @input)))
- (list\fold (function (_ clause total)
- (if (same? _.null total)
- clause
- (_.or clause total)))
- _.null))
+ (list\mix (function (_ clause total)
+ (if (same? _.null total)
+ clause
+ (_.or clause total)))
+ _.null))
branchG])))
conditionals))
.let [foreigns (|> conditionals
@@ -89,10 +89,10 @@
set.list)
@expression (_.constant (reference.artifact [context_module context_artifact]))
directive (_.define_function @expression (list& (_.parameter @input) (list\map _.reference foreigns))
- (list\fold (function (_ [test then] else)
- (_.if test (_.return then) else))
- (_.return elseG)
- conditionalsG))]
+ (list\mix (function (_ [test then] else)
+ (_.if test (_.return then) else))
+ (_.return elseG)
+ conditionalsG))]
_ (generation.execute! directive)
_ (generation.save! context_artifact directive)]
(in (_.apply/* (list& inputG foreigns) @expression))))]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
index c531d05d9..6f51e40f1 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/python/common.lux
@@ -14,26 +14,72 @@
["%" format (#+ format)]]
[collection
["." dictionary]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
[target
- ["_" python (#+ Expression)]]]]
+ ["_" python (#+ Expression Statement)]]]]
["." //// #_
["/" bundle]
["/#" // #_
["." extension]
[generation
+ ["." reference]
[extension (#+ Nullary Unary Binary Trinary
nullary unary binary trinary)]
["//" python #_
- ["#." runtime (#+ Operation Phase Handler Bundle Generator)]]]
+ ["#." runtime (#+ Operation Phase Phase! Handler Bundle Generator)]
+ ["#." primitive]
+ ["#." structure]
+ ["#." reference]
+ ["#." function]
+ ["#." case]
+ ["#." loop]]]
[//
- [synthesis (#+ %synthesis)]
+ [analysis (#+)]
+ ["." synthesis (#+ %synthesis)]
["." generation]
[///
- ["#" phase]]]]])
+ ["#" phase ("#\." monad)]]]]])
+
+(def: .public (statement expression archive synthesis)
+ Phase!
+ (case synthesis
+ ... TODO: Get rid of this ASAP
+ (#synthesis.Extension "lux syntax char case!" parameters)
+ (do /////.monad
+ [body (expression archive synthesis)]
+ (in (:as (Statement Any) body)))
+
+ (^template [<tag>]
+ [(^ (<tag> value))
+ (/////\map _.return (expression archive synthesis))])
+ ([synthesis.bit]
+ [synthesis.i64]
+ [synthesis.f64]
+ [synthesis.text]
+ [synthesis.variant]
+ [synthesis.tuple]
+ [#synthesis.Reference]
+ [synthesis.branch/get]
+ [synthesis.function/apply]
+ [#synthesis.Extension])
+
+ (^ (synthesis.branch/case case))
+ (//case.case! false statement expression archive case)
+
+ (^template [<tag> <generator>]
+ [(^ (<tag> value))
+ (<generator> statement expression archive value)])
+ ([synthesis.branch/let //case.let!]
+ [synthesis.branch/if //case.if!]
+ [synthesis.loop/scope //loop.scope!]
+ [synthesis.loop/recur //loop.recur!])
+
+ (^ (synthesis.function/abstraction abstraction))
+ (/////\map _.return (//function.function statement expression archive abstraction))
+ ))
(def: .public (custom [parser handler])
(All [s]
@@ -59,28 +105,48 @@
(function (_ extension_name phase archive [input else conditionals])
(do {! /////.monad}
[inputG (phase archive input)
- elseG (phase archive else)
+ else! (..statement phase archive else)
@input (\ ! map _.var (generation.identifier "input"))
- conditionalsG (: (Operation (List [(Expression Any)
- (Expression Any)]))
+ conditionals! (: (Operation (List [(Expression Any)
+ (Statement Any)]))
(monad.map ! (function (_ [chars branch])
(do !
- [branchG (phase archive branch)]
+ [branch! (..statement phase archive branch)]
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
- (list\fold (function (_ clause total)
- (if (same? _.none total)
- clause
- (_.or clause total)))
- _.none))
- branchG])))
+ (list\mix (function (_ clause total)
+ (if (same? _.none total)
+ clause
+ (_.or clause total)))
+ _.none))
+ branch!])))
conditionals))
- .let [closure (_.lambda (list @input)
- (list\fold (function (_ [test then] else)
- (_.? test then else))
- elseG
- conditionalsG))]]
- (in (_.apply/* closure (list inputG)))))]))
+ ... .let [dependencies (//case.dependencies (list\mix (function (_ right left)
+ ... (synthesis.path/seq left right))
+ ... (synthesis.path/then input)
+ ... (#.Item (synthesis.path/then else)
+ ... (list\map (|>> product.right
+ ... synthesis.path/then)
+ ... conditionals))))
+ ... @closure (_.var (reference.artifact artifact_id))
+ ... closure (_.def @closure dependencies
+ ... ($_ _.then
+ ... (_.set (list @input) inputG)
+ ... (list\mix (function (_ [test then!] else!)
+ ... (_.if test then! else!))
+ ... else!
+ ... conditionals!)))]
+ ... _ (generation.execute! closure)
+ ... _ (generation.save! (product.right artifact_id) #.None closure)
+ ]
+ ... (in (_.apply/* @closure dependencies))
+ (in (:as (Expression Any)
+ ($_ _.then
+ (_.set (list @input) inputG)
+ (list\mix (function (_ [test then!] else!)
+ (_.if test then! else!))
+ else!
+ conditionals!))))))]))
(def: lux_procs
Bundle
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
index 25e244035..3cc7cf91c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux
@@ -15,7 +15,7 @@
[collection
["." dictionary]
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -75,7 +75,7 @@
... ... branchG])))
... ... conditionals))]
... ... (in (_.let (list [@input inputG])
-... ... (list (list\fold (function (_ [test then] else)
+... ... (list (list\mix (function (_ [test then] else)
... ... (_.if test then else))
... ... elseG
... ... conditionalsG))))))]))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
index db479ccd3..253b342e8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/ruby/common.lux
@@ -14,7 +14,7 @@
["%" format (#+ format)]]
[collection
["." dictionary]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -67,18 +67,18 @@
[branchG (phase archive branch)]
(in [(|> chars
(list\map (|>> .int _.int (_.= @input)))
- (list\fold (function (_ clause total)
- (if (same? _.nil total)
- clause
- (_.or clause total)))
- _.nil))
+ (list\mix (function (_ clause total)
+ (if (same? _.nil total)
+ clause
+ (_.or clause total)))
+ _.nil))
branchG])))
conditionals))
.let [closure (_.lambda #.None (list @input)
- (list\fold (function (_ [test then] else)
- (_.if test (_.return then) else))
- (_.return elseG)
- conditionalsG))]]
+ (list\mix (function (_ [test then] else)
+ (_.if test (_.return then) else))
+ (_.return elseG)
+ conditionalsG))]]
(in (_.apply_lambda/* (list inputG) closure))))]))
(def: lux_procs
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
index 2b2fca71f..79c3cce7b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/scheme/common.lux
@@ -15,7 +15,7 @@
[collection
["." dictionary]
["." set]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["f" frac]]]
@@ -75,10 +75,10 @@
branchG])))
conditionals))]
(in (_.let (list [@input inputG])
- (list\fold (function (_ [test then] else)
- (_.if test then else))
- elseG
- conditionalsG)))))]))
+ (list\mix (function (_ [test then] else)
+ (_.if test then else))
+ elseG
+ conditionalsG)))))]))
(def: lux_procs
Bundle
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
index fae91850c..982b48475 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/case.lux
@@ -9,7 +9,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold monoid)]
+ ["." list ("#\." functor mix monoid)]
["." set]]]
[math
[number
@@ -63,16 +63,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueG (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueG
- pathP))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueG
+ pathP))))
(def: @savepoint (_.var "lux_pm_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
@@ -180,10 +180,10 @@
..peek])
then!])))
(#.Item item))]
- (in (list\fold (function (_ [when then] else)
- (_.if when then else))
- (_.go @fail)
- clauses)))])
+ (in (list\mix (function (_ [when then] else)
+ (_.if when then else))
+ (_.go @fail)
+ clauses)))])
([#/////synthesis.I64_Fork //primitive.i64 _.=/2]
[#/////synthesis.F64_Fork //primitive.f64 _.=/2]
[#/////synthesis.Text_Fork //primitive.text _.string=/2])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
index 41faa95b6..c54bae779 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/function.lux
@@ -10,7 +10,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[target
["_" common_lisp (#+ Expression Var/1)]]]]
["." // #_
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
index 7eca077bf..0b2328715 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/runtime.lux
@@ -290,4 +290,4 @@
(row.row [(%.nat ..module_id)
(|> ..runtime
_.code
- (\ encoding.utf8 encode))])])))
+ (\ encoding.utf8 encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
index 9b0431808..edce73735 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/case.lux
@@ -8,7 +8,7 @@
[data
["." text]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]]]
@@ -77,16 +77,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.i32 (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.i32 (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: @savepoint (_.var "lux_pm_cursor_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
index fdfc768a0..90f1cca9a 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/function.lux
@@ -8,7 +8,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" js (#+ Expression Computation Var Statement)]]]]
["." // #_
@@ -81,12 +81,12 @@
apply_poly (.function (_ args func)
(|> func (_.do "apply" (list _.null args))))
initialize_self! (_.define (//case.register 0) @self)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.define (..input post) (_.at (_.i32 (.int post)) @@arguments))))
- initialize_self!
- (list.indices arity))]
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.define (..input post) (_.at (_.i32 (.int post)) @@arguments))))
+ initialize_self!
+ (list.indices arity))]
environment (monad.map ! (expression archive) environment)
.let [[definition instantiation] (with_closure @self environment
($_ _.then
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux
index 08a3a7c80..8c3762238 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[math
[number
["n" nat]]]
@@ -39,7 +39,7 @@
(_.define variable value)
(_.set variable value)))))
list.reversed
- (list\fold _.then body)))
+ (list\mix _.then body)))
(def: .public (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
index 368c69bb0..3ea974987 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js/runtime.lux
@@ -783,4 +783,4 @@
#.None
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
index 417f74d2d..928fbb101 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/jvm/case.lux
@@ -10,7 +10,7 @@
["." i32]
["n" nat]]
[collection
- ["." list ("#\." fold)]]]
+ ["." list ("#\." mix)]]]
[target
[jvm
["_" bytecode (#+ Label Bytecode) ("#\." monad)]
@@ -241,16 +241,16 @@
(Generator [(List synthesis.Member) Synthesis])
(do phase.monad
[recordG (phase archive recordS)]
- (in (list\fold (function (_ step so_far)
- (.let [next (.case step
- (#.Left lefts)
- (..left_projection lefts)
-
- (#.Right lefts)
- (..right_projection lefts))]
- (_.composite so_far next)))
- recordG
- (list.reversed path)))))
+ (in (list\mix (function (_ step so_far)
+ (.let [next (.case step
+ (#.Left lefts)
+ (..left_projection lefts)
+
+ (#.Right lefts)
+ (..right_projection lefts))]
+ (_.composite so_far next)))
+ recordG
+ (list.reversed path)))))
(def: .public (case phase archive [valueS path])
(Generator [Synthesis Path])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
index ef53de88c..67c156db0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/case.lux
@@ -7,7 +7,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[target
["_" lua (#+ Expression Var Statement)]]]]
@@ -62,16 +62,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: .public (if expression archive [testS thenS elseS])
(Generator [Synthesis Synthesis Synthesis])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
index 509808d62..88f59675d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/function.lux
@@ -10,7 +10,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" lua (#+ Var Expression Label Statement)]]]]
["." // #_
@@ -79,12 +79,12 @@
@scope (..@scope function_name)
@self (_.var (///reference.artifact function_name))
initialize_self! (_.local/1 (//case.register 0) @self)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.local/1 (..input post) (_.item (|> post ++ .int _.int) @curried))))
- initialize_self!
- (list.indices arity))
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.local/1 (..input post) (_.item (|> post ++ .int _.int) @curried))))
+ initialize_self!
+ (list.indices arity))
pack (|>> (list) _.array)
unpack (_.apply/1 (_.var "table.unpack"))
@var_args (_.var "...")]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
index 988274333..997030d05 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/lua/runtime.lux
@@ -430,4 +430,4 @@
#.None
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
index 28744fe33..ccea519f2 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/case.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -83,16 +83,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueG (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueG
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueG
+ (list.reversed pathP)))))
(def: @savepoint (_.var "lux_pm_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
index 175fadfc3..c749c30f2 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/function.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" php (#+ Var Global Expression Argument Label Statement)]]]]
["." // #_
@@ -84,12 +84,12 @@
@selfG (_.global (///reference.artifact function_name))
@selfL (_.var (///reference.artifact function_name))
initialize_self! (_.set! (//case.register 0) @selfL)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.set! (..input post) (_.item (|> post .int _.int) @curried))))
- initialize_self!
- (list.indices arity))]
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.set! (..input post) (_.item (|> post .int _.int) @curried))))
+ initialize_self!
+ (list.indices arity))]
.let [[definition instantiation] (..with_closure closureG+ @selfG @selfL
($_ _.then
(_.set! @num_args (_.func_num_args/0 []))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux
index 9f66b15b3..8baa09008 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set (#+ Set)]]]
[math
[number
@@ -45,7 +45,7 @@
(let [variable (//case.register (n.+ offset register))]
(_.set! variable value))))
list.reversed
- (list\fold _.then body)))
+ (list\mix _.then body)))
(def: .public (scope! statement expression archive [start initsS+ bodyS])
(Generator! (Scope Synthesis))
@@ -89,7 +89,7 @@
(set.of_list _.hash)))
[directive instantiation] (: [Statement Expression]
(case (|> (list\map referenced_variables initsS+)
- (list\fold set.union (referenced_variables bodyS))
+ (list\mix set.union (referenced_variables bodyS))
(set.difference loop_variables)
set.list)
#.End
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
index bd36c0785..8dfb51dd7 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/php/runtime.lux
@@ -607,4 +607,4 @@
(row.row [..module_id
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
index 4426bc6c8..10cb4d3b9 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python.lux
@@ -8,7 +8,7 @@
[target
["_" python]]]]
["." / #_
- [runtime (#+ Phase Phase!)]
+ [runtime (#+ Phase)]
["#." primitive]
["#." structure]
["#." reference]
@@ -18,7 +18,10 @@
["/#" // #_
["#." reference]
["/#" // #_
- ["#." extension]
+ ["#." extension
+ [generation
+ [python
+ ["#/." common]]]]
["/#" // #_
[analysis (#+)]
["#." synthesis]
@@ -27,38 +30,6 @@
[reference (#+)
[variable (#+)]]]]]]])
-(def: (statement expression archive synthesis)
- Phase!
- (case synthesis
- (^template [<tag>]
- [(^ (<tag> value))
- (//////phase\map _.return (expression archive synthesis))])
- ([////synthesis.bit]
- [////synthesis.i64]
- [////synthesis.f64]
- [////synthesis.text]
- [////synthesis.variant]
- [////synthesis.tuple]
- [#////synthesis.Reference]
- [////synthesis.branch/get]
- [////synthesis.function/apply]
- [#////synthesis.Extension])
-
- (^ (////synthesis.branch/case case))
- (/case.case! false statement expression archive case)
-
- (^template [<tag> <generator>]
- [(^ (<tag> value))
- (<generator> statement expression archive value)])
- ([////synthesis.branch/let /case.let!]
- [////synthesis.branch/if /case.if!]
- [////synthesis.loop/scope /loop.scope!]
- [////synthesis.loop/recur /loop.recur!])
-
- (^ (////synthesis.function/abstraction abstraction))
- (//////phase\map _.return (/function.function statement expression archive abstraction))
- ))
-
(exception: .public cannot_recur_as_an_expression)
(def: .public (expression archive synthesis)
@@ -82,7 +53,7 @@
(//reference.reference /reference.system archive value)
(^ (////synthesis.branch/case case))
- (/case.case ..statement expression archive case)
+ (/case.case ///extension/common.statement expression archive case)
(^ (////synthesis.branch/let let))
(/case.let expression archive let)
@@ -94,13 +65,13 @@
(/case.get expression archive get)
(^ (////synthesis.loop/scope scope))
- (/loop.scope ..statement expression archive scope)
+ (/loop.scope ///extension/common.statement expression archive scope)
(^ (////synthesis.loop/recur updates))
(//////phase.except ..cannot_recur_as_an_expression [])
(^ (////synthesis.function/abstraction abstraction))
- (/function.function ..statement expression archive abstraction)
+ (/function.function ///extension/common.statement expression archive abstraction)
(^ (////synthesis.function/apply application))
(/function.apply expression archive application)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
index 5d66730d1..6262f0104 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/case.lux
@@ -7,7 +7,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -88,16 +88,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple::left]
- [#.Right //runtime.tuple::right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple::left]
+ [#.Right //runtime.tuple::right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: @savepoint (_.var "lux_pm_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
index eee714ea8..f4b31f61d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/function.lux
@@ -8,7 +8,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" python (#+ SVar Expression Statement)]]]]
["." // #_
@@ -80,12 +80,12 @@
apply_poly (.function (_ args func)
(_.apply_poly (list) args func))
initialize_self! (_.set (list (//case.register 0)) @self)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.set (list (..input post)) (_.item (|> post .int _.int) @curried))))
- initialize_self!
- (list.indices arity))]]
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.set (list (..input post)) (_.item (|> post .int _.int) @curried))))
+ initialize_self!
+ (list.indices arity))]]
(with_closure function_artifact @self environment
(_.def @self (list (_.poly @curried))
($_ _.then
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
index 6739e6ec5..50469f64e 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/loop.lux
@@ -8,7 +8,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -39,7 +39,7 @@
(_.set (list (//case.register (n.+ offset register)))
value)))
list.reversed
- (list\fold _.then body)))
+ (list\mix _.then body)))
(def: .public (set_scope body!)
(-> (Statement Any) (Statement Any))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
index 207b74654..9952ea02d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/python/runtime.lux
@@ -458,4 +458,4 @@
#.None
(|> ..runtime
_.code
- (\ utf8.codec encode))])]))))
+ (\ utf8.codec encoded))])]))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
index 288fdc4bf..e751e412b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/case.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[macro
["." template]]
@@ -66,16 +66,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple::left]
- [#.Right //runtime.tuple::right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple::left]
+ [#.Right //runtime.tuple::right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: $savepoint (_.var "lux_pm_cursor_savepoint"))
(def: $cursor (_.var "lux_pm_cursor"))
@@ -171,10 +171,10 @@
..peek)
then!])))
(#.Item item))]
- (in (list\fold (function (_ [when then] else)
- (_.if when then else))
- ..fail!
- clauses)))])
+ (in (list\mix (function (_ [when then] else)
+ (_.if when then else))
+ ..fail!
+ clauses)))])
([#/////synthesis.I64_Fork //primitive.i64 //runtime.i64::=]
[#/////synthesis.F64_Fork //primitive.f64 _.=]
[#/////synthesis.Text_Fork //primitive.text _.=])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
index 4ae6231c5..f2335374c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/function.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" r (#+ Expression SVar)]]]]
["." // #_
@@ -97,7 +97,7 @@
(|> arity
list.indices
(list\map input_declaration)
- (list\fold _.then bodyO)))]
+ (list\mix _.then bodyO)))]
[(|> $num_args (_.> arityO))
(let [arity_args (_.slice (_.int +1) arityO $curried)
output_func_args (_.slice (|> arityO (_.+ (_.int +1)))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux
index 859744980..28ac47ffb 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor)]
["." set (#+ Set)]]]
[math
[number
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
index 21f2ded5a..f0ea2c3fb 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux
@@ -850,4 +850,4 @@
(row.row [(%.nat ..module_id)
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
index 2af4e0dee..df08d8a21 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/case.lux
@@ -9,7 +9,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -90,16 +90,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: @savepoint (_.local "lux_pm_savepoint"))
(def: @cursor (_.local "lux_pm_cursor"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
index 192807829..efc132065 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
@@ -8,7 +8,7 @@
[text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
[target
["_" ruby (#+ LVar GVar Expression Statement)]]]]
["." // #_
@@ -77,12 +77,12 @@
@num_args (_.local "num_args")
@self (_.local function_name)
initialize_self! (_.set (list (//case.register 0)) @self)
- initialize! (list\fold (.function (_ post pre!)
- ($_ _.then
- pre!
- (_.set (list (..input post)) (_.item (|> post .int _.int) @curried))))
- initialize_self!
- (list.indices arity))
+ initialize! (list\mix (.function (_ post pre!)
+ ($_ _.then
+ pre!
+ (_.set (list (..input post)) (_.item (|> post .int _.int) @curried))))
+ initialize_self!
+ (list.indices arity))
[declaration instatiation] (with_closure closureO+ function_name
(_.lambda (#.Some @self) (list (_.variadic @curried))
($_ _.then
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux
index 9fe46c86d..caf3afb78 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -39,7 +39,7 @@
(_.set (list (//case.register (n.+ offset register)))
value)))
list.reversed
- (list\fold _.then body)))
+ (list\mix _.then body)))
(def: symbol
(_.symbol "lux_continue"))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
index 8a825e466..b083c0a67 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/runtime.lux
@@ -401,4 +401,4 @@
#.None
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
index ae841dc5b..e68b23464 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/case.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[macro
["." template]]
@@ -64,16 +64,16 @@
(Generator [(List Member) Synthesis])
(do ///////phase.monad
[valueO (expression archive valueS)]
- (in (list\fold (function (_ side source)
- (.let [method (.case side
- (^template [<side> <accessor>]
- [(<side> lefts)
- (<accessor> (_.int (.int lefts)))])
- ([#.Left //runtime.tuple//left]
- [#.Right //runtime.tuple//right]))]
- (method source)))
- valueO
- (list.reversed pathP)))))
+ (in (list\mix (function (_ side source)
+ (.let [method (.case side
+ (^template [<side> <accessor>]
+ [(<side> lefts)
+ (<accessor> (_.int (.int lefts)))])
+ ([#.Left //runtime.tuple//left]
+ [#.Right //runtime.tuple//right]))]
+ (method source)))
+ valueO
+ (list.reversed pathP)))))
(def: @savepoint (_.var "lux_pm_cursor_savepoint"))
(def: @cursor (_.var "lux_pm_cursor"))
@@ -165,10 +165,10 @@
..peek)
then!])))
(#.Item item))]
- (in (list\fold (function (_ [when then] else)
- (_.if when then else))
- ..fail!
- clauses)))])
+ (in (list\mix (function (_ [when then] else)
+ (_.if when then else))
+ ..fail!
+ clauses)))])
([#/////synthesis.I64_Fork //primitive.i64 _.=/2]
[#/////synthesis.F64_Fork //primitive.f64 _.=/2]
[#/////synthesis.Text_Fork //primitive.text _.string=?/2])
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
index 58d8b55c6..cfb345097 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/function.lux
@@ -10,7 +10,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor)]]]
[target
["_" scheme (#+ Expression Computation Var)]]]]
["." // #_
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux
index fb9add0aa..87ddc4929 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/loop.lux
@@ -8,7 +8,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor)]
["." set (#+ Set)]]]
[math
[number
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
index 452da33ef..221ee6d88 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/scheme/runtime.lux
@@ -367,4 +367,4 @@
(row.row [(%.nat ..module_id)
(|> ..runtime
_.code
- (\ utf8.codec encode))])])))
+ (\ utf8.codec encoded))])])))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
index 1a178900e..d2bf439da 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/case.lux
@@ -11,7 +11,7 @@
["." bit ("#\." equivalence)]
["." text ("#\." equivalence)]
[collection
- ["." list ("#\." functor fold monoid)]
+ ["." list ("#\." functor mix monoid)]
["." set (#+ Set)]]]
[math
[number
@@ -72,22 +72,22 @@
(#///analysis.Complex (#///analysis.Tuple tuple))
(let [tuple::last (-- (list.size tuple))]
- (list\fold (function (_ [tuple::lefts tuple::member] nextC)
- (.case tuple::member
- (#///analysis.Simple #///analysis.Unit)
- nextC
-
- _
- (let [right? (n.= tuple::last tuple::lefts)
- end?' (and end? right?)]
- (<| (///\map (|>> (#/.Seq (#/.Access (#/.Member (if right?
- (#.Right (-- tuple::lefts))
- (#.Left tuple::lefts)))))))
- (path' tuple::member end?')
- (when> [(new> (not end?') [])] [(///\map ..clean_up)])
- nextC))))
- thenC
- (list.reversed (list.enumeration tuple))))
+ (list\mix (function (_ [tuple::lefts tuple::member] nextC)
+ (.case tuple::member
+ (#///analysis.Simple #///analysis.Unit)
+ nextC
+
+ _
+ (let [right? (n.= tuple::last tuple::lefts)
+ end?' (and end? right?)]
+ (<| (///\map (|>> (#/.Seq (#/.Access (#/.Member (if right?
+ (#.Right (-- tuple::lefts))
+ (#.Left tuple::lefts)))))))
+ (path' tuple::member end?')
+ (when> [(new> (not end?') [])] [(///\map ..clean_up)])
+ nextC))))
+ thenC
+ (list.reversed (list.enumeration tuple))))
))
(def: (path archive synthesize pattern bodyA)
@@ -110,7 +110,7 @@
(def: (weave_fork weave equivalence new_fork old_fork)
(All [a] (-> (-> Path Path Path) (Equivalence a) (/.Fork a Path) (/.Fork a Path)
(/.Fork a Path)))
- (list\fold (..weave_branch weave equivalence) old_fork (#.Item new_fork)))
+ (list\mix (..weave_branch weave equivalence) old_fork (#.Item new_fork)))
(def: (weave new old)
(-> Path Path Path)
@@ -228,7 +228,7 @@
(do {! ///.monad}
[headSP (path archive synthesize headP headA)
tailSP+ (monad.map ! (product.uncurried (path archive synthesize)) tailPA+)]
- (in (/.branch/case [input (list\fold weave headSP tailSP+)]))))
+ (in (/.branch/case [input (list\mix weave headSP tailSP+)]))))
(template: (!masking <variable> <output>)
[[[(#///analysis.Bind <variable>)
@@ -358,11 +358,11 @@
(#/.Text_Fork forks))
(|> (#.Item forks)
(list\map product.right)
- (list\fold for_path path_storage))
+ (list\mix for_path path_storage))
(^or (^ (/.path/seq left right))
(^ (/.path/alt left right)))
- (list\fold for_path path_storage (list left right))
+ (list\mix for_path path_storage (list left right))
(^ (/.path/then bodyS))
(loop for_synthesis
@@ -373,7 +373,7 @@
(for_synthesis valueS synthesis_storage)
(^ (/.tuple members))
- (list\fold for_synthesis synthesis_storage members)
+ (list\mix for_synthesis synthesis_storage members)
(#/.Reference (#///reference.Variable (#///reference/variable.Local register)))
(if (set.member? (value@ #bindings synthesis_storage) register)
@@ -384,10 +384,10 @@
(revised@ #dependencies (set.has var) synthesis_storage)
(^ (/.function/apply [functionS argsS]))
- (list\fold for_synthesis synthesis_storage (#.Item functionS argsS))
+ (list\mix for_synthesis synthesis_storage (#.Item functionS argsS))
(^ (/.function/abstraction [environment arity bodyS]))
- (list\fold for_synthesis synthesis_storage environment)
+ (list\mix for_synthesis synthesis_storage environment)
(^ (/.branch/case [inputS pathS]))
(revised@ #dependencies
@@ -403,7 +403,7 @@
(for_synthesis inputS synthesis_storage))
(^ (/.branch/if [testS thenS elseS]))
- (list\fold for_synthesis synthesis_storage (list testS thenS elseS))
+ (list\mix for_synthesis synthesis_storage (list testS thenS elseS))
(^ (/.branch/get [access whole]))
(for_synthesis whole synthesis_storage)
@@ -417,13 +417,13 @@
(set.of_list n.hash))))
(for_synthesis iterationS)
(value@ #dependencies)))
- (list\fold for_synthesis synthesis_storage initsS+))
+ (list\mix for_synthesis synthesis_storage initsS+))
(^ (/.loop/recur replacementsS+))
- (list\fold for_synthesis synthesis_storage replacementsS+)
+ (list\mix for_synthesis synthesis_storage replacementsS+)
(#/.Extension [extension argsS])
- (list\fold for_synthesis synthesis_storage argsS)
+ (list\mix for_synthesis synthesis_storage argsS)
_
synthesis_storage))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
index f26b13ade..2aeacc78d 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/function.lux
@@ -12,7 +12,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor monoid fold)]]]
+ ["." list ("#\." functor monoid)]]]
[math
[number
["n" nat]]]]]
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
index 39082e826..bba61a90f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/loop.lux
@@ -178,22 +178,24 @@
... TODO: Stop relying on this custom code.
(^ (#/.Extension ["lux syntax char case!" (list& input else matches)]))
- (do {! maybe.monad}
- [input (recur false input)
- matches (monad.map !
- (function (_ match)
- (case match
- (^ (#/.Structure (#analysis.Tuple (list when then))))
- (do !
- [when (recur false when)
- then (recur return? then)]
- (in (#/.Structure (#analysis.Tuple (list when then)))))
-
- _
- (recur false match)))
- matches)
- else (recur return? else)]
- (in (#/.Extension ["lux syntax char case!" (list& input else matches)])))
+ (if return?
+ (do {! maybe.monad}
+ [input (recur false input)
+ matches (monad.map !
+ (function (_ match)
+ (case match
+ (^ (#/.Structure (#analysis.Tuple (list when then))))
+ (do !
+ [when (recur false when)
+ then (recur return? then)]
+ (in (#/.Structure (#analysis.Tuple (list when then)))))
+
+ _
+ (recur false match)))
+ matches)
+ else (recur return? else)]
+ (in (#/.Extension ["lux syntax char case!" (list& input else matches)])))
+ #.None)
(#/.Extension [name args])
(|> args
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
index cb647c284..88b2d3f1f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/synthesis/variable.lux
@@ -13,7 +13,7 @@
["%" format]]
[collection
["." dictionary (#+ Dictionary)]
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." set]]]
[math
[number
@@ -181,10 +181,10 @@
(-> Register Nat Redundancy [(List Register) Redundancy])
(let [extension (|> amount list.indices (list\map (n.+ offset)))]
[extension
- (list\fold (function (_ register redundancy)
- (dictionary.has register ..necessary! redundancy))
- redundancy
- extension)]))
+ (list\mix (function (_ register redundancy)
+ (dictionary.has register ..necessary! redundancy))
+ redundancy
+ extension)]))
(def: (default arity)
(-> Arity Redundancy)
@@ -310,10 +310,10 @@
(and (set.member? bindings register)
redundant?)))
(list\map product.left))]]
- (in [(list\fold dictionary.lacks redundancy (set.list bindings))
+ (in [(list\mix dictionary.lacks redundancy (set.list bindings))
(|> redundants
(list.sorted n.>)
- (list\fold (..remove_local_from_path ..remove_local) (#/.Seq pre post)))]))
+ (list\mix (..remove_local_from_path ..remove_local) (#/.Seq pre post)))]))
(#/.Then then)
(do try.monad
@@ -405,7 +405,7 @@
[[redundancy inits] (..list_optimization optimization' [redundancy inits])
.let [[extension redundancy] (..extended start (list.size inits) redundancy)]
[redundancy iteration] (optimization' [redundancy iteration])]
- (in [(list\fold dictionary.lacks redundancy extension)
+ (in [(list\mix dictionary.lacks redundancy extension)
(#/.Control (#/.Loop (#/.Scope [start inits iteration])))]))
(#/.Recur resets)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
index d4b612bf2..3105f2ad8 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
@@ -333,7 +333,7 @@
[(case (|> <source_code>
(!clip <start> <end>)
(text.replaced ..digit_separator "")
- (\ <codec> decode))
+ (\ <codec> decoded))
(#.Right output)
(#.Right [[(let [[where::file where::line where::column] where]
[where::file where::line (!n/+ (!n/- <start> <end>) where::column)])
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
index d810d7aca..e1ea19e37 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive.lux
@@ -20,7 +20,7 @@
[format
["." binary (#+ Writer)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." set]
["." row (#+ Row)]]]
@@ -198,15 +198,15 @@
:representation
(revised@ #next (n.max +next))
(revised@ #resolver (function (_ resolver)
- (list\fold (function (_ [module [id entry]] resolver)
- (case entry
- (#.Some _)
- (dictionary.has module [id entry] resolver)
-
- #.None
- resolver))
- resolver
- (dictionary.entries +resolver))))
+ (list\mix (function (_ [module [id entry]] resolver)
+ (case entry
+ (#.Some _)
+ (dictionary.has module [id entry] resolver)
+
+ #.None
+ resolver))
+ resolver
+ (dictionary.entries +resolver))))
:abstraction)))
(type: Reservation
@@ -279,8 +279,8 @@
(correct_reservations? reservations))]
(in (:abstraction
{#next next
- #resolver (list\fold (function (_ [module id] archive)
- (dictionary.has module [id #.None] archive))
- (value@ #resolver (:representation ..empty))
- reservations)}))))
+ #resolver (list\mix (function (_ [module id] archive)
+ (dictionary.has module [id #.None] archive))
+ (value@ #resolver (:representation ..empty))
+ reservations)}))))
)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
index e4cc633de..af69bbdc9 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/archive/artifact.lux
@@ -14,7 +14,7 @@
["%" format (#+ format)]]
[collection
["." list]
- ["." row (#+ Row) ("#\." functor fold)]
+ ["." row (#+ Row) ("#\." functor mix)]
["." dictionary (#+ Dictionary)]]
[format
["." binary (#+ Writer)]]]
@@ -145,21 +145,21 @@
_ (<>.failure (exception.error ..invalid_category [tag])))))]
(|> (<binary>.row/64 category)
- (\ <>.monad map (row\fold (function (_ artifact registry)
- (product.right
- (case artifact
- #Anonymous
- (..resource registry)
-
- (^template [<tag> <create>]
- [(<tag> name)
- (<create> name registry)])
- ([#Definition ..definition]
- [#Analyser ..analyser]
- [#Synthesizer ..synthesizer]
- [#Generator ..generator]
- [#Directive ..directive]
- [#Custom ..custom])
- )))
- ..empty)))))
+ (\ <>.monad map (row\mix (function (_ artifact registry)
+ (product.right
+ (case artifact
+ #Anonymous
+ (..resource registry)
+
+ (^template [<tag> <create>]
+ [(<tag> name)
+ (<create> name registry)])
+ ([#Definition ..definition]
+ [#Analyser ..analyser]
+ [#Synthesizer ..synthesizer]
+ [#Generator ..generator]
+ [#Directive ..directive]
+ [#Custom ..custom])
+ )))
+ ..empty)))))
)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
index 6ee936f42..e2a3ef238 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/cache/dependency.lux
@@ -13,7 +13,7 @@
["." text
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." set (#+ Set)]]]]]
[///
@@ -46,9 +46,9 @@
(def: .public graph
(-> (List Dependency) Graph)
- (list\fold (function (_ [module imports] graph)
- (dictionary.has module imports graph))
- ..empty))
+ (list\mix (function (_ [module imports] graph)
+ (dictionary.has module imports graph))
+ ..empty))
(def: (ancestry archive)
(-> Archive Graph)
@@ -62,15 +62,15 @@
(#try.Failure error)
..fresh)]
ancestors (monad.map ! recur (set.list parents))]
- (in (list\fold set.union parents ancestors)))))
+ (in (list\mix set.union parents ancestors)))))
ancestry (memo.open memo)]
- (list\fold (function (_ module memory)
- (if (dictionary.key? memory module)
- memory
- (let [[memory _] (ancestry [memory module])]
- memory)))
- ..empty
- (archive.archived archive))))
+ (list\mix (function (_ module memory)
+ (if (dictionary.key? memory module)
+ memory
+ (let [[memory _] (ancestry [memory module])]
+ memory)))
+ ..empty
+ (archive.archived archive))))
(def: (dependency? ancestry target source)
(-> Graph Module Module Bit)
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
index b4fa30d12..45f489e8b 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/archive.lux
@@ -19,7 +19,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." row (#+ Row)]
["." set]]]
@@ -384,19 +384,19 @@
(-> (List [Bit [Module [archive.ID [Descriptor (Document .Module)]]]])
dependency.Order
Purge)
- (list\fold (function (_ [module_name [module_id [descriptor document]]] purge)
- (let [purged? (: (Predicate Module)
- (dictionary.key? purge))]
- (if (purged? module_name)
- purge
- (if (|> descriptor
- (value@ #descriptor.references)
- set.list
- (list.any? purged?))
- (dictionary.has module_name module_id purge)
- purge))))
- (..initial_purge caches)
- load_order))
+ (list\mix (function (_ [module_name [module_id [descriptor document]]] purge)
+ (let [purged? (: (Predicate Module)
+ (dictionary.key? purge))]
+ (if (purged? module_name)
+ purge
+ (if (|> descriptor
+ (value@ #descriptor.references)
+ set.list
+ (list.any? purged?))
+ (dictionary.has module_name module_id purge)
+ purge))))
+ (..initial_purge caches)
+ load_order))
(def: pseudo_module
Text
@@ -422,10 +422,10 @@
[module_name [module_id [descriptor document]]]])))))))
load_order (|> pre_loaded_caches
(list\map product.right)
- (monad.fold try.monad
- (function (_ [module [module_id [descriptor document]]] archive)
- (archive.has module [descriptor document (: Output row.empty)] archive))
- archive)
+ (monad.mix try.monad
+ (function (_ [module [module_id [descriptor document]]] archive)
+ (archive.has module [descriptor document (: Output row.empty)] archive))
+ archive)
(\ try.monad map (dependency.load_order $.key))
(\ try.monad join)
async\in)
@@ -442,22 +442,22 @@
bundles])))))]
(async\in
(do {! try.monad}
- [archive (monad.fold !
- (function (_ [[module descriptor,document,output] _bundle] archive)
- (archive.has module descriptor,document,output archive))
- archive
- loaded_caches)
+ [archive (monad.mix !
+ (function (_ [[module descriptor,document,output] _bundle] archive)
+ (archive.has module descriptor,document,output archive))
+ archive
+ loaded_caches)
analysis_state (..analysis_state (value@ #static.host static) archive)]
(in [archive
analysis_state
- (list\fold (function (_ [_ [+analysers +synthesizers +generators +directives]]
- [analysers synthesizers generators directives])
- [(dictionary.merged +analysers analysers)
- (dictionary.merged +synthesizers synthesizers)
- (dictionary.merged +generators generators)
- (dictionary.merged +directives directives)])
- ..empty_bundles
- loaded_caches)])))))
+ (list\mix (function (_ [_ [+analysers +synthesizers +generators +directives]]
+ [analysers synthesizers generators directives])
+ [(dictionary.merged +analysers analysers)
+ (dictionary.merged +synthesizers synthesizers)
+ (dictionary.merged +generators generators)
+ (dictionary.merged +directives directives)])
+ ..empty_bundles
+ loaded_caches)])))))
(def: .public (thaw host_environment fs static import contexts)
(All [expression directive]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
index 979edaa76..74d5aab33 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/io/context.lux
@@ -127,7 +127,7 @@
(Async (Try Input)))
(do (try.with async.monad)
[[path binary] (..find_any_source_file fs importer import contexts partial_host_extension module)]
- (case (\ utf8.codec decode binary)
+ (case (\ utf8.codec decoded binary)
(#try.Success code)
(in {#////.module module
#////.file path
@@ -145,17 +145,17 @@
(do {! (try.with async.monad)}
[enumeration (|> directory
(\ fs directory_files)
- (\ ! map (monad.fold ! (function (_ file enumeration)
- (if (text.ends_with? ..lux_extension file)
- (do !
- [source_code (\ fs read file)]
- (async\in (dictionary.has' (text.replaced context "" file) source_code enumeration)))
- (in enumeration)))
- enumeration))
+ (\ ! map (monad.mix ! (function (_ file enumeration)
+ (if (text.ends_with? ..lux_extension file)
+ (do !
+ [source_code (\ fs read file)]
+ (async\in (dictionary.has' (text.replaced context "" file) source_code enumeration)))
+ (in enumeration)))
+ enumeration))
(\ ! join))]
(|> directory
(\ fs sub_directories)
- (\ ! map (monad.fold ! (context_listing fs context) enumeration))
+ (\ ! map (monad.mix ! (context_listing fs context) enumeration))
(\ ! join))))
(def: Action
@@ -175,14 +175,14 @@
(-> (file.System Async) (List Context) (Action Enumeration))
(let [! (: (Monad Action)
(try.with async.monad))]
- (monad.fold !
- (function (_ context enumeration)
- (do !
- [context (..canonical fs context)]
- (..context_listing fs
- (format context (\ fs separator))
- context
- enumeration)))
- (: Enumeration
- (dictionary.empty text.hash))
- contexts)))
+ (monad.mix !
+ (function (_ context enumeration)
+ (do !
+ [context (..canonical fs context)]
+ (..context_listing fs
+ (format context (\ fs separator))
+ context
+ enumeration)))
+ (: Enumeration
+ (dictionary.empty text.hash))
+ contexts)))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
index d9707b0c0..ffee37de6 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/jvm.lux
@@ -154,11 +154,11 @@
(def: (write_module static [module output] sink)
(-> Static [archive.ID Output] java/util/jar/JarOutputStream
(Try java/util/jar/JarOutputStream))
- (monad.fold try.monad
- (function (_ [artifact custom content] sink)
- (..write_class static module artifact custom content sink))
- sink
- (row.list output)))
+ (monad.mix try.monad
+ (function (_ [artifact custom content] sink)
+ (..write_class static module artifact custom content sink))
+ sink
+ (row.list output)))
(def: (read_jar_entry_with_unknown_size input)
(-> java/util/jar/JarInputStream [Nat Binary])
@@ -251,14 +251,14 @@
sink (|> order
(list\map (function (_ [module [module_id [descriptor document output]]])
[module_id output]))
- (monad.fold ! (..write_module static)
- (java/util/jar/JarOutputStream::new buffer (..manifest program))))
+ (monad.mix ! (..write_module static)
+ (java/util/jar/JarOutputStream::new buffer (..manifest program))))
[entries duplicates sink] (|> host_dependencies
dictionary.values
- (monad.fold ! ..write_host_dependency
- [(set.empty text.hash)
- (set.empty text.hash)
- sink]))
+ (monad.mix ! ..write_host_dependency
+ [(set.empty text.hash)
+ (set.empty text.hash)
+ sink]))
.let [_ (do_to sink
(java/io/Flushable::flush)
(java/io/Closeable::close))]]
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
index a229c78a1..f888e6975 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
@@ -14,7 +14,7 @@
["." encoding]]
[collection
["." row]
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary (#+ Dictionary)]
["." set]]
[format
@@ -58,19 +58,19 @@
(-> Output (Try _.Expression))
(|>> row.list
(list\map product.right)
- (monad.fold try.monad
- (function (_ content so_far)
- (|> content
- (\ encoding.utf8 decode)
- (\ try.monad map
- (|>> :expected
- (:sharing [directive]
- directive
- so_far
-
- directive)
- (..then so_far)))))
- (: _.Expression (_.manual "")))))
+ (monad.mix try.monad
+ (function (_ content so_far)
+ (|> content
+ (\ encoding.utf8 decoded)
+ (\ try.monad map
+ (|>> :expected
+ (:sharing [directive]
+ directive
+ so_far
+
+ directive)
+ (..then so_far)))))
+ (: _.Expression (_.manual "")))))
(def: module_file
(-> archive.ID file.Path)
@@ -108,10 +108,10 @@
set.list
(list.all (function (_ module) (dictionary.value module mapping)))
(list\map (|>> ..module_file _.string _.load_relative/1))
- (list\fold ..then bundle)
+ (list\mix ..then bundle)
(: _.Expression)
_.code
- (\ encoding.utf8 encode)
+ (\ encoding.utf8 encoded)
tar.content))
module_file (tar.path (..module_file module_id))]
(in (#tar.Normal [module_file now ..mode ..ownership entry_content]))))
diff --git a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
index fd6437557..9b49232e3 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/script.lux
@@ -40,19 +40,19 @@
(|> output
row.list
(list\map (|>> product.right product.right))
- (monad.fold try.monad
- (function (_ content so_far)
- (|> content
- (\ utf8.codec decode)
- (\ try.monad map
- (|>> :expected
- (:sharing [directive]
- directive
- so_far
-
- directive)
- (sequence so_far)))))
- so_far)))
+ (monad.mix try.monad
+ (function (_ content so_far)
+ (|> content
+ (\ utf8.codec decoded)
+ (\ try.monad map
+ (|>> :expected
+ (:sharing [directive]
+ directive
+ so_far
+
+ directive)
+ (sequence so_far)))))
+ so_far)))
(def: .public (package header code sequence scope)
(All [directive]
@@ -67,5 +67,5 @@
(|> order
(list\map (function (_ [module [module_id [descriptor document output]]])
[module_id output]))
- (monad.fold ! (..write_module sequence) header)
- (\ ! map (|>> scope code (\ utf8.codec encode)))))))
+ (monad.mix ! (..write_module sequence) header)
+ (\ ! map (|>> scope code (\ utf8.codec encoded)))))))
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index 2a99dded3..e1e42c28c 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -18,7 +18,7 @@
["." name ("#\." equivalence codec)]
[collection
["." array]
- ["." list ("#\." functor monoid fold)]]]
+ ["." list ("#\." functor monoid mix)]]]
["." macro
[syntax (#+ syntax:)]
["." code]]
@@ -92,7 +92,7 @@
(text.enclosed' text.double_quote name)
(|> params
(list\map (|>> format (text\compose " ")))
- (list\fold (function.flipped text\compose) ""))
+ (list\mix (function.flipped text\compose) ""))
")")
(^template [<tag> <open> <close> <flat>]
@@ -102,7 +102,7 @@
(list\map format)
list.reversed
(list.interposed " ")
- (list\fold text\compose ""))
+ (list\mix text\compose ""))
<close>)])
([#.Sum "(Or " ")" flat_variant]
[#.Product "[" "]" flat_tuple])
@@ -114,21 +114,21 @@
(list\map format)
list.reversed
(list.interposed " ")
- (list\fold text\compose ""))
+ (list\mix text\compose ""))
" " (format out) ")"))
(#.Parameter idx)
- (n\encode idx)
+ (n\encoded idx)
(#.Var id)
- ($_ text\compose "⌈v:" (n\encode id) "⌋")
+ ($_ text\compose "⌈v:" (n\encoded id) "⌋")
(#.Ex id)
- ($_ text\compose "⟨e:" (n\encode id) "⟩")
+ ($_ text\compose "⟨e:" (n\encoded id) "⟩")
(#.Apply param fun)
(let [[type_func type_args] (flat_application type)]
- ($_ text\compose "(" (format type_func) " " (|> type_args (list\map format) list.reversed (list.interposed " ") (list\fold text\compose "")) ")"))
+ ($_ text\compose "(" (format type_func) " " (|> type_args (list\map format) list.reversed (list.interposed " ") (list\mix text\compose "")) ")"))
(^template [<tag> <desc>]
[(<tag> env body)
@@ -167,12 +167,12 @@
(#.Parameter idx)
(maybe.else (panic! ($_ text\compose
"Unknown type parameter" text.new_line
- " Index: " (n\encode idx) text.new_line
+ " Index: " (n\encoded idx) text.new_line
"Environment: " (|> env
list.enumeration
(list\map (.function (_ [index type])
($_ text\compose
- (n\encode index)
+ (n\encoded index)
" " (..format type))))
(text.interposed (text\compose text.new_line " ")))))
(list.item idx env))
@@ -191,9 +191,9 @@
[(#.Primitive xname xparams) (#.Primitive yname yparams)]
(and (text\= xname yname)
(n.= (list.size yparams) (list.size xparams))
- (list\fold (.function (_ [x y] prev) (and prev (= x y)))
- #1
- (list.zipped/2 xparams yparams)))
+ (list\mix (.function (_ [x y] prev) (and prev (= x y)))
+ #1
+ (list.zipped/2 xparams yparams)))
(^template [<tag>]
[[(<tag> xid) (<tag> yid)]
@@ -218,9 +218,9 @@
[(#.ExQ xenv xbody) (#.ExQ yenv ybody)])
(and (n.= (list.size yenv) (list.size xenv))
(= xbody ybody)
- (list\fold (.function (_ [x y] prev) (and prev (= x y)))
- #1
- (list.zipped/2 xenv yenv)))
+ (list\mix (.function (_ [x y] prev) (and prev (= x y)))
+ #1
+ (list.zipped/2 xenv yenv)))
_
#0
@@ -421,13 +421,13 @@
valueT (meta.type valueN)
.let [_ ("lux io log"
($_ text\compose
- (name\encode (name_of ..:log!)) " " (location.format location) text.new_line
+ (name\encoded (name_of ..:log!)) " " (location.format location) text.new_line
"Expression: " (case valueC
(#.Some valueC)
(code.format valueC)
#.None
- (name\encode valueN))
+ (name\encoded valueN))
text.new_line
" Type: " (..format valueT)))]]
(in (list (code.identifier valueN))))
diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux
index 9b657cb19..57d9ae3ab 100644
--- a/stdlib/source/library/lux/type/abstract.lux
+++ b/stdlib/source/library/lux/type/abstract.lux
@@ -194,15 +194,15 @@
(def: abstraction_type_name
(-> Name Text)
- (|>> name\encode
+ (|>> name\encoded
($_ text\compose
- (name\encode (name_of #..Abstraction))
+ (name\encoded (name_of #..Abstraction))
" ")))
(def: representation_definition_name
(-> Text Text)
(|>> ($_ text\compose
- (name\encode (name_of #..Representation))
+ (name\encoded (name_of #..Representation))
" ")))
(def: declaration
diff --git a/stdlib/source/library/lux/type/check.lux b/stdlib/source/library/lux/type/check.lux
index aa8e213af..3e6f6a8c4 100644
--- a/stdlib/source/library/lux/type/check.lux
+++ b/stdlib/source/library/lux/type/check.lux
@@ -30,11 +30,11 @@
(exception: .public (unknown_type_var {id Nat})
(exception.report
- ["ID" (n\encode id)]))
+ ["ID" (n\encoded id)]))
(exception: .public (unbound_type_var {id Nat})
(exception.report
- ["ID" (n\encode id)]))
+ ["ID" (n\encoded id)]))
(exception: .public (invalid_type_application {funcT Type} {argT Type})
(exception.report
@@ -43,7 +43,7 @@
(exception: .public (cannot_rebind_var {id Nat} {type Type} {bound Type})
(exception.report
- ["Var" (n\encode id)]
+ ["Var" (n\encoded id)]
["Wanted Type" (//.format type)]
["Current Type" (//.format bound)]))
@@ -86,7 +86,7 @@
(def: &functor ..functor)
- (def: (apply ff fa)
+ (def: (on fa ff)
(function (_ context)
(case (ff context)
(#try.Success [context' f])
@@ -441,12 +441,12 @@
(in assumptions)
... Fuse 2 rings
(do !
- [_ (monad.fold ! (function (_ interpose to)
- (do !
- [_ (link/3 interpose to idE)]
- (in interpose)))
- targetE
- (set.list ringA))]
+ [_ (monad.mix ! (function (_ interpose to)
+ (do !
+ [_ (link/3 interpose to idE)]
+ (in interpose)))
+ targetE
+ (set.list ringA))]
(in assumptions))))
(^template [<pattern> <id> <type>]
diff --git a/stdlib/source/library/lux/type/implicit.lux b/stdlib/source/library/lux/type/implicit.lux
index cc54a82a1..8af389efc 100644
--- a/stdlib/source/library/lux/type/implicit.lux
+++ b/stdlib/source/library/lux/type/implicit.lux
@@ -14,7 +14,7 @@
["." text ("#\." equivalence)
["%" format (#+ format)]]
[collection
- ["." list ("#\." monad fold)]
+ ["." list ("#\." monad mix)]
["." dictionary (#+ Dictionary)]]]
["." macro
["." code]
@@ -119,24 +119,24 @@
(def: (available_definitions source_module target_module constants aggregate)
(-> Text Text (List [Text Definition]) (-> (List [Name Type]) (List [Name Type])))
- (list\fold (function (_ [name [exported? def_type def_anns def_value]] aggregate)
- (if (and (annotation.implementation? def_anns)
- (or (text\= target_module source_module)
- exported?))
- (#.Item [[source_module name] def_type] aggregate)
- aggregate))
- aggregate
- constants))
+ (list\mix (function (_ [name [exported? def_type def_anns def_value]] aggregate)
+ (if (and (annotation.implementation? def_anns)
+ (or (text\= target_module source_module)
+ exported?))
+ (#.Item [[source_module name] def_type] aggregate)
+ aggregate))
+ aggregate
+ constants))
(def: local_env
(Meta (List [Name Type]))
(do meta.monad
[local_batches meta.locals
- .let [total_locals (list\fold (function (_ [name type] table)
- (try.else table (dictionary.has' name type table)))
- (: (Dictionary Text Type)
- (dictionary.empty text.hash))
- (list\join local_batches))]]
+ .let [total_locals (list\mix (function (_ [name type] table)
+ (try.else table (dictionary.has' name type table)))
+ (: (Dictionary Text Type)
+ (dictionary.empty text.hash))
+ (list\join local_batches))]]
(in (|> total_locals
dictionary.entries
(list\map (function (_ [name type]) [["" name] type]))))))
@@ -154,10 +154,10 @@
[this_module_name meta.current_module_name
imported_modules (meta.imported_modules this_module_name)
accessible_definitions (monad.map ! meta.definitions imported_modules)]
- (in (list\fold (function (_ [imported_module definitions] tail)
- (available_definitions imported_module this_module_name definitions tail))
- #.End
- (list.zipped/2 imported_modules accessible_definitions)))))
+ (in (list\mix (function (_ [imported_module definitions] tail)
+ (available_definitions imported_module this_module_name definitions tail))
+ #.End
+ (list.zipped/2 imported_modules accessible_definitions)))))
(def: (on_argument arg func)
(-> Type Type (Check Type))
@@ -197,7 +197,7 @@
(def: (ensure_function_application! member_type input_types expected_output)
(-> Type (List Type) Type (Check []))
(do check.monad
- [actual_output (monad.fold check.monad ..on_argument member_type input_types)]
+ [actual_output (monad.mix check.monad ..on_argument member_type input_types)]
(check.check expected_output actual_output)))
(type: #rec Instance
diff --git a/stdlib/source/library/lux/type/poly.lux b/stdlib/source/library/lux/type/poly.lux
index 51f0b7618..8fba22756 100644
--- a/stdlib/source/library/lux/type/poly.lux
+++ b/stdlib/source/library/lux/type/poly.lux
@@ -14,7 +14,7 @@
["." product]
["." text]
[collection
- ["." list ("#\." fold functor)]
+ ["." list ("#\." functor)]
["." dictionary]]]
[macro (#+ with_identifiers)
["." code]
diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux
index fee4aaf79..3e37d8b30 100644
--- a/stdlib/source/library/lux/type/resource.lux
+++ b/stdlib/source/library/lux/type/resource.lux
@@ -16,7 +16,7 @@
[collection
["." set]
["." row (#+ Row)]
- ["." list ("#\." functor fold)]]]
+ ["." list ("#\." functor mix)]]]
["." macro
[syntax (#+ syntax:)]]
[math
@@ -165,15 +165,15 @@
(#.Item head tail)
(do {! meta.monad}
- [.let [max_idx (list\fold n.max head tail)]
+ [.let [max_idx (list\mix n.max head tail)]
g!inputs (<| (monad.all !) (list.repeated (++ max_idx)) (macro.identifier "input"))
- .let [g!outputs (|> (monad.fold maybe.monad
- (function (_ from to)
- (do maybe.monad
- [input (list.item from g!inputs)]
- (in (row.suffix input to))))
- (: (Row Code) row.empty)
- swaps)
+ .let [g!outputs (|> (monad.mix maybe.monad
+ (function (_ from to)
+ (do maybe.monad
+ [input (list.item from g!inputs)]
+ (in (row.suffix input to))))
+ (: (Row Code) row.empty)
+ swaps)
maybe.trusted
row.list)
g!inputsT+ (list\map (|>> (~) (..Key ..Commutative) (`)) g!inputs)
diff --git a/stdlib/source/library/lux/world/file/watch.lux b/stdlib/source/library/lux/world/file/watch.lux
index 0e5deec4a..1625f79ef 100644
--- a/stdlib/source/library/lux/world/file/watch.lux
+++ b/stdlib/source/library/lux/world/file/watch.lux
@@ -20,7 +20,7 @@
["%" format (#+ format)]]
[collection
["." dictionary (#+ Dictionary)]
- ["." list ("#\." functor monoid fold)]
+ ["." list ("#\." functor monoid mix)]
["." set]
["." array]]]
[math
@@ -35,43 +35,43 @@
(abstract: .public Concern
{#.doc (example "A particular concern to watch-out for.")}
- {#create Bit
- #modify Bit
- #delete Bit}
+ {#creation Bit
+ #modification Bit
+ #deletion Bit}
(def: none
Concern
(:abstraction
- {#create false
- #modify false
- #delete false}))
+ {#creation false
+ #modification false
+ #deletion false}))
(template [<concern> <predicate> <event> <create> <modify> <delete>]
[(def: .public <concern>
Concern
(:abstraction
- {#create <create>
- #modify <modify>
- #delete <delete>}))
+ {#creation <create>
+ #modification <modify>
+ #deletion <delete>}))
(def: .public <predicate>
(Predicate Concern)
(|>> :representation (value@ <event>)))]
- [creation creation? #create
+ [creation creation? #creation
true false false]
- [modification modification? #modify
+ [modification modification? #modification
false true false]
- [deletion deletion? #delete
+ [deletion deletion? #deletion
false false true]
)
(def: .public (also left right)
(-> Concern Concern Concern)
(:abstraction
- {#create (or (..creation? left) (..creation? right))
- #modify (or (..modification? left) (..modification? right))
- #delete (or (..deletion? left) (..deletion? right))}))
+ {#creation (or (..creation? left) (..creation? right))
+ #modification (or (..modification? left) (..modification? right))
+ #deletion (or (..deletion? left) (..deletion? right))}))
(def: .public all
Concern
@@ -126,14 +126,14 @@
(-> (//.System Async) //.Path (Async (Try File_Tracker)))
(do {! (try.with async.monad)}
[files (\ fs directory_files directory)]
- (monad.fold !
- (function (_ file tracker)
- (do !
- [last_modified (\ fs last_modified file)]
- (in (dictionary.has file last_modified tracker))))
- (: File_Tracker
- (dictionary.empty text.hash))
- files)))
+ (monad.mix !
+ (function (_ file tracker)
+ (do !
+ [last_modified (\ fs last_modified file)]
+ (in (dictionary.has file last_modified tracker))))
+ (: File_Tracker
+ (dictionary.empty text.hash))
+ files)))
(def: (available_files fs directory)
(-> (//.System Async) //.Path (Async (Try (List [//.Path Instant]))))
@@ -172,15 +172,15 @@
current_files)]]
(in [[directory
[concern
- (let [with_deletions (list\fold dictionary.lacks file_tracker deletions)
- with_creations (list\fold (function (_ [path last_modified] tracker)
- (dictionary.has path last_modified tracker))
- with_deletions
- creations)
- with_modifications (list\fold (function (_ [path previous_modification current_modification] tracker)
- (dictionary.has path current_modification tracker))
- with_creations
- modifications)]
+ (let [with_deletions (list\mix dictionary.lacks file_tracker deletions)
+ with_creations (list\mix (function (_ [path last_modified] tracker)
+ (dictionary.has path last_modified tracker))
+ with_deletions
+ creations)
+ with_modifications (list\mix (function (_ [path previous_modification current_modification] tracker)
+ (dictionary.has path current_modification tracker))
+ with_creations
+ modifications)]
with_modifications)]]
[creations
modifications
@@ -243,13 +243,13 @@
tracker))]
(in (#try.Success [])))
.let [[creations modifications deletions]
- (list\fold (function (_ [_ [creations modifications deletions]]
- [all_creations all_modifications all_deletions])
- [(list\compose creations all_creations)
- (list\compose modifications all_modifications)
- (list\compose deletions all_deletions)])
- [(list) (list) (list)]
- changes)]]
+ (list\mix (function (_ [_ [creations modifications deletions]]
+ [all_creations all_modifications all_deletions])
+ [(list\compose creations all_creations)
+ (list\compose modifications all_modifications)
+ (list\compose deletions all_deletions)])
+ [(list) (list) (list)]
+ changes)]]
(in ($_ list\compose
(list\map (|>> product.left [..creation]) creations)
(|> modifications
@@ -340,7 +340,7 @@
(|>> java/nio/file/WatchKey::pollEvents
(\ io.monad map (|>> ..default_list
(list\map default_event_concern)
- (list\fold ..also ..none)))))
+ (list\mix ..also ..none)))))
(import: java/nio/file/WatchService
["#::."
@@ -364,11 +364,11 @@
(def: (default_start watch_events watcher path)
(-> (List Watch_Event) java/nio/file/WatchService //.Path (Async (Try java/nio/file/WatchKey)))
- (let [watch_events' (list\fold (function (_ [index watch_event] watch_events')
- (ffi.write! index watch_event watch_events'))
- (ffi.array (java/nio/file/WatchEvent$Kind java/lang/Object)
- (list.size watch_events))
- (list.enumeration watch_events))]
+ (let [watch_events' (list\mix (function (_ [index watch_event] watch_events')
+ (ffi.write! index watch_event watch_events'))
+ (ffi.array (java/nio/file/WatchEvent$Kind java/lang/Object)
+ (list.size watch_events))
+ (list.enumeration watch_events))]
(async.future
(java/nio/file/Path::register watcher
watch_events'
diff --git a/stdlib/source/library/lux/world/net/http/request.lux b/stdlib/source/library/lux/world/net/http/request.lux
index 5b0a254e4..30adaea99 100644
--- a/stdlib/source/library/lux/world/net/http/request.lux
+++ b/stdlib/source/library/lux/world/net/http/request.lux
@@ -20,7 +20,7 @@
["." json (#+ JSON)]
["." context (#+ Context Property)]]
[collection
- ["." list ("#\." functor fold)]
+ ["." list ("#\." functor mix)]
["." dictionary]]]
[world
["." binary (#+ Binary)]]]]
@@ -32,23 +32,23 @@
(def: (merge inputs)
(-> (List Binary) Binary)
(let [[_ output] (try.trusted
- (monad.fold try.monad
- (function (_ input [offset output])
- (let [amount (binary.size input)]
- (\ try.functor map (|>> [(n.+ amount offset)])
- (binary.copy amount 0 input offset output))))
- [0 (|> inputs
- (list\map binary.size)
- (list\fold n.+ 0)
- binary.empty)]
- inputs))]
+ (monad.mix try.monad
+ (function (_ input [offset output])
+ (let [amount (binary.size input)]
+ (\ try.functor map (|>> [(n.+ amount offset)])
+ (binary.copy amount 0 input offset output))))
+ [0 (|> inputs
+ (list\map binary.size)
+ (list\mix n.+ 0)
+ binary.empty)]
+ inputs))]
output))
(def: (read_text_body body)
(-> Body (Async (Try Text)))
(do async.monad
[blobs (frp.list body)]
- (in (\ encoding.utf8 decode (merge blobs)))))
+ (in (\ encoding.utf8 decoded (merge blobs)))))
(def: failure (//response.bad_request ""))
@@ -59,7 +59,7 @@
[?raw (read_text_body (value@ #//.body message))]
(case (do try.monad
[raw ?raw
- content (\ json.codec decode raw)]
+ content (\ json.codec decoded raw)]
(json.result content reader))
(#try.Success input)
(server input request)
diff --git a/stdlib/source/library/lux/world/net/http/response.lux b/stdlib/source/library/lux/world/net/http/response.lux
index b49715c4d..b129584d5 100644
--- a/stdlib/source/library/lux/world/net/http/response.lux
+++ b/stdlib/source/library/lux/world/net/http/response.lux
@@ -29,7 +29,7 @@
(def: .public empty
(-> Status Response)
- (let [body (frp\in (\ encoding.utf8 encode ""))]
+ (let [body (frp\in (\ encoding.utf8 encoded ""))]
(function (_ status)
[status
{#//.headers (|> context.empty
@@ -56,7 +56,7 @@
(def: .public bad_request
(-> Text Response)
- (|>> (\ encoding.utf8 encode) (content status.bad_request mime.utf_8)))
+ (|>> (\ encoding.utf8 encoded) (content status.bad_request mime.utf_8)))
(def: .public ok
(-> MIME Binary Response)
@@ -65,10 +65,10 @@
(template [<name> <type> <mime> <pre>]
[(def: .public <name>
(-> <type> Response)
- (|>> <pre> (\ encoding.utf8 encode) (..ok <mime>)))]
+ (|>> <pre> (\ encoding.utf8 encoded) (..ok <mime>)))]
[text Text mime.utf_8 (<|)]
[html html.Document mime.html html.html]
[css CSS mime.css css.css]
- [json JSON mime.json json\encode]
+ [json JSON mime.json json\encoded]
)
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index d59b72786..a86f33a67 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -25,7 +25,7 @@
["." utf8]]]
[collection
["." array (#+ Array)]
- ["." list ("#\." fold functor)]
+ ["." list ("#\." mix functor)]
["." dictionary]]]
[math
[number (#+ hex)
@@ -181,12 +181,12 @@
(def: (jvm::arguments_array arguments)
(-> (List Argument) (Array java/lang/String))
(product.right
- (list\fold (function (_ argument [idx output])
- [(++ idx) (jvm.write! idx
- (:as java/lang/String argument)
- output)])
- [0 (jvm.array java/lang/String (list.size arguments))]
- arguments)))
+ (list\mix (function (_ argument [idx output])
+ [(++ idx) (jvm.write! idx
+ (:as java/lang/String argument)
+ output)])
+ [0 (jvm.array java/lang/String (list.size arguments))]
+ arguments)))
(import: (java/util/Map k v)
["#::."
@@ -196,14 +196,14 @@
(-> Environment
(java/util/Map java/lang/String java/lang/String)
(java/util/Map java/lang/String java/lang/String))
- (list\fold (function (_ [key value] target')
- (exec
- (java/util/Map::put (:as java/lang/String key)
- (:as java/lang/String value)
- target')
- target'))
- target
- (dictionary.entries input)))
+ (list\mix (function (_ [key value] target')
+ (exec
+ (java/util/Map::put (:as java/lang/String key)
+ (:as java/lang/String value)
+ target')
+ target'))
+ target
+ (dictionary.entries input)))
(import: java/io/Reader
["#::."
@@ -263,7 +263,7 @@
[error jvm_error]
))
(def: (write message)
- (java/io/OutputStream::write (\ utf8.codec encode message) jvm_output))
+ (java/io/OutputStream::write (\ utf8.codec encoded message) jvm_output))
(~~ (template [<name> <method>]
[(def: (<name> _)
(<method> process))]