aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/library/lux.lux153
-rw-r--r--stdlib/source/library/lux/abstract/comonad.lux2
-rw-r--r--stdlib/source/library/lux/abstract/monad.lux6
-rw-r--r--stdlib/source/library/lux/control/concatenative.lux8
-rw-r--r--stdlib/source/library/lux/control/concurrency/semaphore.lux2
-rw-r--r--stdlib/source/library/lux/control/parser.lux13
-rw-r--r--stdlib/source/library/lux/control/parser/text.lux20
-rw-r--r--stdlib/source/library/lux/control/parser/tree.lux2
-rw-r--r--stdlib/source/library/lux/control/state.lux4
-rw-r--r--stdlib/source/library/lux/control/thread.lux9
-rw-r--r--stdlib/source/library/lux/control/try.lux18
-rw-r--r--stdlib/source/library/lux/control/writer.lux2
-rw-r--r--stdlib/source/library/lux/data/collection/array.lux41
-rw-r--r--stdlib/source/library/lux/data/collection/bits.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/ordered.lux10
-rw-r--r--stdlib/source/library/lux/data/collection/dictionary/plist.lux3
-rw-r--r--stdlib/source/library/lux/data/collection/list.lux6
-rw-r--r--stdlib/source/library/lux/data/collection/queue/priority.lux9
-rw-r--r--stdlib/source/library/lux/data/collection/set/multi.lux5
-rw-r--r--stdlib/source/library/lux/data/collection/set/ordered.lux4
-rw-r--r--stdlib/source/library/lux/data/collection/tree/finger.lux7
-rw-r--r--stdlib/source/library/lux/data/collection/tree/zipper.lux15
-rw-r--r--stdlib/source/library/lux/data/format/css.lux4
-rw-r--r--stdlib/source/library/lux/data/format/css/selector.lux6
-rw-r--r--stdlib/source/library/lux/data/format/css/value.lux4
-rw-r--r--stdlib/source/library/lux/data/format/html.lux6
-rw-r--r--stdlib/source/library/lux/data/format/json.lux6
-rw-r--r--stdlib/source/library/lux/data/format/markdown.lux12
-rw-r--r--stdlib/source/library/lux/data/format/tar.lux54
-rw-r--r--stdlib/source/library/lux/data/text.lux10
-rw-r--r--stdlib/source/library/lux/data/text/format.lux2
-rw-r--r--stdlib/source/library/lux/data/text/regex.lux186
-rw-r--r--stdlib/source/library/lux/debug.lux16
-rw-r--r--stdlib/source/library/lux/ffi.old.lux118
-rw-r--r--stdlib/source/library/lux/macro.lux39
-rw-r--r--stdlib/source/library/lux/macro/syntax/definition.lux2
-rw-r--r--stdlib/source/library/lux/math/number/i16.lux3
-rw-r--r--stdlib/source/library/lux/math/number/i8.lux3
-rw-r--r--stdlib/source/library/lux/meta.lux6
-rw-r--r--stdlib/source/library/lux/target/common_lisp.lux4
-rw-r--r--stdlib/source/library/lux/target/js.lux17
-rw-r--r--stdlib/source/library/lux/target/jvm/type/descriptor.lux4
-rw-r--r--stdlib/source/library/lux/target/jvm/type/signature.lux10
-rw-r--r--stdlib/source/library/lux/target/lua.lux18
-rw-r--r--stdlib/source/library/lux/target/php.lux6
-rw-r--r--stdlib/source/library/lux/target/python.lux4
-rw-r--r--stdlib/source/library/lux/target/ruby.lux22
-rw-r--r--stdlib/source/library/lux/target/scheme.lux6
-rw-r--r--stdlib/source/library/lux/time.lux16
-rw-r--r--stdlib/source/library/lux/time/date.lux10
-rw-r--r--stdlib/source/library/lux/time/instant.lux4
-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/coverage.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/generation/r/common.lux6
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux2
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/r/runtime.lux10
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/program.lux14
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux4
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux30
-rw-r--r--stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux2
-rw-r--r--stdlib/source/library/lux/type.lux2
-rw-r--r--stdlib/source/library/lux/type/refinement.lux8
-rw-r--r--stdlib/source/library/lux/world/db/sql.lux144
-rw-r--r--stdlib/source/library/lux/world/net/http/cookie.lux21
-rw-r--r--stdlib/source/library/lux/world/net/http/query.lux8
-rw-r--r--stdlib/source/library/lux/world/net/http/route.lux10
-rw-r--r--stdlib/source/library/lux/world/service/authentication.lux16
-rw-r--r--stdlib/source/library/lux/world/service/crud.lux24
-rw-r--r--stdlib/source/library/lux/world/service/inventory.lux24
-rw-r--r--stdlib/source/library/lux/world/service/journal.lux12
-rw-r--r--stdlib/source/library/lux/world/service/mail.lux12
-rw-r--r--stdlib/source/library/lux/world/shell.lux4
-rw-r--r--stdlib/source/program/scriptum.lux2
-rw-r--r--stdlib/source/test/lux.lux35
-rw-r--r--stdlib/source/test/lux/control/concurrency/semaphore.lux2
-rw-r--r--stdlib/source/test/lux/control/parser.lux4
-rw-r--r--stdlib/source/test/lux/control/parser/text.lux12
-rw-r--r--stdlib/source/test/lux/control/parser/tree.lux2
-rw-r--r--stdlib/source/test/lux/control/remember.lux8
-rw-r--r--stdlib/source/test/lux/data/collection/list.lux6
-rw-r--r--stdlib/source/test/lux/data/collection/tree/zipper.lux64
-rw-r--r--stdlib/source/test/lux/data/text.lux8
-rw-r--r--stdlib/source/test/lux/debug.lux4
-rw-r--r--stdlib/source/test/lux/ffi.jvm.lux2
-rw-r--r--stdlib/source/test/lux/macro.lux32
-rw-r--r--stdlib/source/test/lux/macro/local.lux4
-rw-r--r--stdlib/source/test/lux/macro/template.lux2
-rw-r--r--stdlib/source/test/lux/math/number/int.lux6
-rw-r--r--stdlib/source/test/lux/math/number/nat.lux6
-rw-r--r--stdlib/source/test/lux/math/number/rev.lux6
-rw-r--r--stdlib/source/test/lux/type/abstract.lux2
-rw-r--r--stdlib/source/test/lux/type/refinement.lux12
-rw-r--r--stdlib/source/test/lux/type/resource.lux2
95 files changed, 832 insertions, 707 deletions
diff --git a/stdlib/source/library/lux.lux b/stdlib/source/library/lux.lux
index 9f2b0a697..9bf50bba5 100644
--- a/stdlib/source/library/lux.lux
+++ b/stdlib/source/library/lux.lux
@@ -1400,11 +1400,11 @@
(failure "Wrong syntax for def:'''")}
tokens))
-(def:''' (as_pairs xs)
+(def:''' (pairs xs)
#End
(All [a] (-> ($' List a) ($' List (& a a))))
({(#Item x (#Item y xs'))
- (#Item [x y] (as_pairs xs'))
+ (#Item [x y] (pairs xs'))
_
#End}
@@ -1419,7 +1419,7 @@
(form$ (list (record$ (list [label body])) value))}
binding)))
body
- (list\reverse (as_pairs bindings)))))
+ (list\reverse (pairs bindings)))))
_
(failure "Wrong syntax for let'")}
@@ -1587,7 +1587,7 @@
value))}
var))))
body
- (list\reverse (as_pairs bindings)))]
+ (list\reverse (pairs bindings)))]
(return (list (form$ (list (record$ (list [(record$ (list [(tag$ ["library/lux" "in"]) g!in] [(tag$ ["library/lux" "bind"]) g!bind]))
body']))
monad)))))
@@ -1651,10 +1651,15 @@
(failure "Wrong syntax for if")}
tokens))
+(def:''' PList
+ #End
+ Type
+ (All [a] ($' List (& Text a))))
+
(def:''' (get k plist)
#End
(All [a]
- (-> Text ($' List (& Text a)) ($' Maybe a)))
+ (-> Text ($' PList a) ($' Maybe a)))
({(#Item [[k' v] plist'])
(if (text\= k k')
(#Some v)
@@ -1667,7 +1672,7 @@
(def:''' (put k v dict)
#End
(All [a]
- (-> Text a ($' List (& Text a)) ($' List (& Text a))))
+ (-> Text a ($' PList a) ($' PList a)))
({#End
(list [k v])
@@ -1742,7 +1747,7 @@
(#Left ($_ text\compose "Unknown module: " module " @ " (name\encode full_name)))}
(get module modules))))
-(def:''' (as_code_list expression)
+(def:''' (code_list expression)
#End
(-> Code Code)
(let' [type (form$ (list (tag$ ["library/lux" "Apply"])
@@ -1760,13 +1765,13 @@
(#Item lastI inits)
(do meta_monad
[lastO ({[_ (#Form (#Item [[_ (#Identifier ["" "~+"])] (#Item [spliced #End])]))]
- (in (as_code_list spliced))
+ (in (code_list spliced))
_
(do meta_monad
[lastO (untemplate lastI)]
- (in (as_code_list (form$ (list (tag$ ["library/lux" "Item"])
- (tuple$ (list lastO (tag$ ["library/lux" "End"]))))))))}
+ (in (code_list (form$ (list (tag$ ["library/lux" "Item"])
+ (tuple$ (list lastO (tag$ ["library/lux" "End"]))))))))}
lastI)]
(monad\fold meta_monad
(function' [leftI rightO]
@@ -1774,7 +1779,7 @@
(let' [g!in-module (form$ (list (text$ "lux in-module")
(text$ "library/lux")
(identifier$ ["library/lux" "list\compose"])))]
- (in (form$ (list g!in-module (as_code_list spliced) rightO))))
+ (in (form$ (list g!in-module (code_list spliced) rightO))))
_
(do meta_monad
@@ -2309,7 +2314,7 @@
#None)}
("lux type check" Global gdef))))
-(def:''' (normalize name)
+(def:''' (normal name)
#End
(-> Name ($' Meta Name))
({["" name]
@@ -2340,7 +2345,7 @@
#End
(-> Name ($' Meta Bit))
(do meta_monad
- [name (normalize name)
+ [name (normal name)
output (macro name)]
(in ({(#Some _) #1
#None #0}
@@ -2360,13 +2365,13 @@
(list& x sep (interpose sep xs'))}
xs))
-(def:''' (macro_expand_once token)
+(def:''' (single_expansion token)
#End
(-> Code ($' Meta ($' List Code)))
- ({[_ (#Form (#Item [_ (#Identifier macro_name)] args))]
+ ({[_ (#Form (#Item [_ (#Identifier name)] args))]
(do meta_monad
- [macro_name' (normalize macro_name)
- ?macro (macro macro_name')]
+ [name' (normal name)
+ ?macro (macro name')]
({(#Some macro)
(("lux type as" Macro' macro) args)
@@ -2378,18 +2383,18 @@
(return (list token))}
token))
-(def:''' (macro_expand token)
+(def:''' (expansion token)
#End
(-> Code ($' Meta ($' List Code)))
- ({[_ (#Form (#Item [_ (#Identifier macro_name)] args))]
+ ({[_ (#Form (#Item [_ (#Identifier name)] args))]
(do meta_monad
- [macro_name' (normalize macro_name)
- ?macro (macro macro_name')]
+ [name' (normal name)
+ ?macro (macro name')]
({(#Some macro)
(do meta_monad
- [expansion (("lux type as" Macro' macro) args)
- expansion' (monad\map meta_monad macro_expand expansion)]
- (in (list\join expansion')))
+ [top_level_expansion (("lux type as" Macro' macro) args)
+ recursive_expansion (monad\map meta_monad expansion top_level_expansion)]
+ (in (list\join recursive_expansion)))
#None
(return (list token))}
@@ -2399,33 +2404,33 @@
(return (list token))}
token))
-(def:''' (macro_expand_all syntax)
+(def:''' (full_expansion syntax)
#End
(-> Code ($' Meta ($' List Code)))
- ({[_ (#Form (#Item [_ (#Identifier macro_name)] args))]
+ ({[_ (#Form (#Item [_ (#Identifier name)] args))]
(do meta_monad
- [macro_name' (normalize macro_name)
- ?macro (macro macro_name')]
+ [name' (normal name)
+ ?macro (macro name')]
({(#Some macro)
(do meta_monad
[expansion (("lux type as" Macro' macro) args)
- expansion' (monad\map meta_monad macro_expand_all expansion)]
+ expansion' (monad\map meta_monad full_expansion expansion)]
(in (list\join expansion')))
#None
(do meta_monad
- [args' (monad\map meta_monad macro_expand_all args)]
- (in (list (form$ (#Item (identifier$ macro_name) (list\join args'))))))}
+ [args' (monad\map meta_monad full_expansion args)]
+ (in (list (form$ (#Item (identifier$ name) (list\join args'))))))}
?macro))
[_ (#Form members)]
(do meta_monad
- [members' (monad\map meta_monad macro_expand_all members)]
+ [members' (monad\map meta_monad full_expansion members)]
(in (list (form$ (list\join members')))))
[_ (#Tuple members)]
(do meta_monad
- [members' (monad\map meta_monad macro_expand_all members)]
+ [members' (monad\map meta_monad full_expansion members)]
(in (list (tuple$ (list\join members')))))
[_ (#Record pairs)]
@@ -2434,7 +2439,7 @@
(function' [kv]
(let' [[key val] kv]
(do meta_monad
- [val' (macro_expand_all val)]
+ [val' (full_expansion val)]
({(#Item val'' #End)
(return [key val''])
@@ -2483,7 +2488,7 @@
"(type (All [a] (Maybe (List a))))"))])
({(#Item type #End)
(do meta_monad
- [type+ (macro_expand_all type)]
+ [type+ (full_expansion type)]
({(#Item type' #End)
(in (list (walk_type type')))
@@ -2751,18 +2756,18 @@
(def:' (expander branches)
(-> (List Code) (Meta (List Code)))
- ({(#Item [_ (#Form (#Item [_ (#Identifier macro_name)] macro_args))]
+ ({(#Item [_ (#Form (#Item [_ (#Identifier name)] args))]
(#Item body
branches'))
(do meta_monad
- [??? (macro? macro_name)]
+ [??? (macro? name)]
(if ???
(do meta_monad
- [init_expansion (macro_expand_once (form$ (list& (identifier$ macro_name) (form$ macro_args) body branches')))]
+ [init_expansion (single_expansion (form$ (list& (identifier$ name) (form$ args) body branches')))]
(expander init_expansion))
(do meta_monad
[sub_expansion (expander branches')]
- (in (list& (form$ (list& (identifier$ macro_name) macro_args))
+ (in (list& (form$ (list& (identifier$ name) args))
body
sub_expansion)))))
@@ -2795,7 +2800,7 @@
({(#Item value branches)
(do meta_monad
[expansion (expander branches)]
- (in (list (` ((~ (record$ (as_pairs expansion))) (~ value))))))
+ (in (list (` ((~ (record$ (pairs expansion))) (~ value))))))
_
(failure "Wrong syntax for case")}
@@ -2815,7 +2820,7 @@
(case tokens
(#Item [_ (#Form (#Item pattern #End))] (#Item body branches))
(do meta_monad
- [pattern+ (macro_expand_all pattern)]
+ [pattern+ (full_expansion pattern)]
(case pattern+
(#Item pattern' #End)
(in (list& pattern' body branches))
@@ -2875,7 +2880,7 @@
(case tokens
(^ (list [_ (#Tuple bindings)] body))
(if (multiple? 2 (list\size bindings))
- (|> bindings as_pairs list\reverse
+ (|> bindings pairs list\reverse
(list\fold (: (-> [Code Code] Code Code)
(function' [lr body']
(let' [[l r] lr]
@@ -3173,8 +3178,8 @@
(case ?parts
(#Some name args meta sigs)
(do meta_monad
- [name+ (normalize name)
- sigs' (monad\map meta_monad macro_expand sigs)
+ [name+ (normal name)
+ sigs' (monad\map meta_monad expansion sigs)
members (: (Meta (List [Text Code]))
(monad\map meta_monad
(: (-> Code (Meta [Text Code]))
@@ -3236,7 +3241,7 @@
[and (if (~ pre) (~ post) #0) "'and' requires >=1 clauses." "Short-circuiting 'and': (and #1 #0 #1) ## => #0"]
[or (if (~ pre) #1 (~ post)) "'or' requires >=1 clauses." "Short-circuiting 'or': (or #1 #0 #1) ## => #1"])
-(def: (index_of part text)
+(def: (index part text)
(-> Text Text (Maybe Nat))
("lux text index" 0 part text))
@@ -3271,7 +3276,7 @@
(def: (text\split_all_with splitter input)
(-> Text Text (List Text))
- (case (..index_of splitter input)
+ (case (..index splitter input)
#None
(list input)
@@ -3494,7 +3499,7 @@
(macro: #export (implementation tokens)
{#.doc "Not meant to be used directly. Prefer 'implementation:'."}
(do meta_monad
- [tokens' (monad\map meta_monad macro_expand tokens)
+ [tokens' (monad\map meta_monad expansion tokens)
struct_type get_expected_type
tags+type (resolve_type_tags struct_type)
tags (: (Meta (List Name))
@@ -3777,7 +3782,7 @@
(def: (text\split_with token sample)
(-> Text Text (Maybe [Text Text]))
(do ..maybe_monad
- [index (..index_of token sample)
+ [index (..index token sample)
#let [[pre post'] (text\split! index sample)
[_ post] (text\split! ("lux text size" token) post')]]
(in [pre post])))
@@ -4235,9 +4240,9 @@
{#.doc (text$ ($_ "lux text concat"
"## Same as the 'open' macro, but meant to be used as a pattern-matching macro for generating local bindings." ..\n
"## Takes an 'alias' text for the generated local bindings." ..\n
- "(def: #export (range (^open ''.'') from to)" ..\n
+ "(def: #export (range (^open ''.'') minimum additional)" ..\n
" (All [a] (-> (Enum a) a a (List a)))" ..\n
- " (range' <= succ from to))"))}
+ " (range' <= succ minimum additional))"))}
(case tokens
(^ (list& [_ (#Form (list [_ (#Text alias)]))] body branches))
(do meta_monad
@@ -4299,7 +4304,7 @@
(let [[right left] branch]
(` (if (~ left) (~ right) (~ else))))))
else
- (as_pairs branches'))))
+ (pairs branches'))))
_
(failure "Wrong syntax for cond"))))
@@ -4331,7 +4336,7 @@
(case tokens
(^ (list [_ (#Tag slot')] record))
(do meta_monad
- [slot (normalize slot')
+ [slot (normal slot')
output (resolve_tag slot)
#let [[idx tags exported? type] output]
g!_ (gensym "_")
@@ -4546,7 +4551,7 @@
_
(failure "Wrong syntax for refer")))
-(def: (refer_to_code module_name module_alias' [r_defs r_opens])
+(def: (refer_code module_name module_alias' [r_defs r_opens])
(-> Text (Maybe Text) Refer Code)
(let [module_alias (..default module_name module_alias')
localizations (: (List Code)
@@ -4608,7 +4613,7 @@
tuple$)
=refers (list\map (: (-> Importation Code)
(function (_ [m_name m_alias =refer])
- (refer_to_code m_name m_alias =refer)))
+ (refer_code m_name m_alias =refer)))
imports)
=module (` ("lux def module" [(~ location_code)
(#.Record (~ (process_def_meta _meta)))]
@@ -4646,7 +4651,7 @@
(case tokens
(^ (list [_ (#Tag slot')] value record))
(do meta_monad
- [slot (normalize slot')
+ [slot (normal slot')
output (resolve_tag slot)
#let [[idx tags exported? type] output]]
(case (resolve_struct_type type)
@@ -4735,7 +4740,7 @@
(case tokens
(^ (list [_ (#Tag slot')] fun record))
(do meta_monad
- [slot (normalize slot')
+ [slot (normal slot')
output (resolve_tag slot)
#let [[idx tags exported? type] output]]
(case (resolve_struct_type type)
@@ -5031,15 +5036,15 @@
(#Item y ys')
(list& x y (interleave xs' ys')))))
-(def: (type_to_code type)
+(def: (type_code type)
(-> Type Code)
(case type
(#Primitive name params)
- (` (#.Primitive (~ (text$ name)) (~ (untemplated_list (list\map type_to_code params)))))
+ (` (#.Primitive (~ (text$ name)) (~ (untemplated_list (list\map type_code params)))))
(^template [<tag>]
[(<tag> left right)
- (` (<tag> (~ (type_to_code left)) (~ (type_to_code right))))])
+ (` (<tag> (~ (type_code left)) (~ (type_code right))))])
([#.Sum] [#.Product]
[#.Function]
[#.Apply])
@@ -5051,15 +5056,15 @@
(^template [<tag>]
[(<tag> env type)
- (let [env' (untemplated_list (list\map type_to_code env))]
- (` (<tag> (~ env') (~ (type_to_code type)))))])
+ (let [env' (untemplated_list (list\map type_code env))]
+ (` (<tag> (~ env') (~ (type_code type)))))])
([#.UnivQ] [#.ExQ])
(#Named [module name] anonymous)
## TODO: Generate the explicit type definition instead of using
## the "identifier$" shortcut below.
## (` (#.Named [(~ (text$ module)) (~ (text$ name))]
- ## (~ (type_to_code anonymous))))
+ ## (~ (type_code anonymous))))
(identifier$ [module name])))
(macro: #export (loop tokens)
@@ -5089,7 +5094,7 @@
#.None)]
(case ?params
(#.Some [name bindings body])
- (let [pairs (as_pairs bindings)
+ (let [pairs (pairs bindings)
vars (list\map first pairs)
inits (list\map second pairs)]
(if (every? identifier? inits)
@@ -5101,8 +5106,8 @@
init_types (monad\map meta_monad type_definition inits')
expected get_expected_type]
(return (list (` (("lux type check"
- (-> (~+ (list\map type_to_code init_types))
- (~ (type_to_code expected)))
+ (-> (~+ (list\map type_code init_types))
+ (~ (type_code expected)))
(function ((~ name) (~+ vars))
(~ body)))
(~+ inits))))))
@@ -5139,8 +5144,8 @@
#None
(failure "Wrong syntax for ^slots")))
#let [[hslot tslots] slots]
- hslot (normalize hslot)
- tslots (monad\map meta_monad normalize tslots)
+ hslot (..normal hslot)
+ tslots (monad\map meta_monad ..normal tslots)
output (resolve_tag hslot)
g!_ (gensym "_")
#let [[idx tags exported? type] output
@@ -5221,9 +5226,9 @@
(case tokens
(^ (list& [_ (#Tuple bindings)] bodies))
(case bindings
- (^ (list& [_ (#Identifier ["" var_name])] macro_expr bindings'))
+ (^ (list& [_ (#Identifier ["" var_name])] expr bindings'))
(do meta_monad
- [expansion (macro_expand_once macro_expr)]
+ [expansion (single_expansion expr)]
(case (place_tokens var_name expansion (` (.with_expansions
[(~+ bindings')]
(~+ bodies))))
@@ -5409,7 +5414,7 @@
#None
(case (~ g!temp)
(~+ next_branches))}
- ("lux type check" (#.Apply (~ (type_to_code expected)) Maybe)
+ ("lux type check" (#.Apply (~ (type_code expected)) Maybe)
(case (~ g!temp)
(~+ (multi_level_case$ g!temp [mlc body]))
@@ -5526,7 +5531,7 @@
(^ (list expr))
(do meta_monad
[type get_expected_type]
- (in (list (` ("lux type as" (~ (type_to_code type)) (~ expr))))))
+ (in (list (` ("lux type as" (~ (type_code type)) (~ expr))))))
_
(failure (..wrong_syntax_error (name_of ..:assume)))))
@@ -5572,7 +5577,7 @@
(^ (list [_ (#Identifier var_name)]))
(do meta_monad
[var_type (type_definition var_name)]
- (in (list (type_to_code var_type))))
+ (in (list (type_code var_type))))
(^ (list expression))
(do meta_monad
@@ -5717,7 +5722,7 @@
_
(failure ($_ text\compose
"Invalid target platform (must be a value of type Text): " (name\encode identifier)
- " : " (..code\encode (..type_to_code type))))))
+ " : " (..code\encode (..type_code type))))))
_
(failure ($_ text\compose
@@ -5919,7 +5924,7 @@
(^ (list [_ (#Tuple bindings)] bodyT))
(if (multiple? 2 (list\size bindings))
(return (list (` (..with_expansions [(~+ (|> bindings
- ..as_pairs
+ ..pairs
(list\map (function (_ [localT valueT])
(list localT (` (..as_is (~ valueT))))))
(list\fold list\compose (list))))]
diff --git a/stdlib/source/library/lux/abstract/comonad.lux b/stdlib/source/library/lux/abstract/comonad.lux
index 205958b26..2c1a731f3 100644
--- a/stdlib/source/library/lux/abstract/comonad.lux
+++ b/stdlib/source/library/lux/abstract/comonad.lux
@@ -59,7 +59,7 @@
(` (|> (~ value) (~ g!split) ((~ g!map) (function ((~ g!_) (~ var)) (~ body')))))
))))
body
- (list.reverse (list.as_pairs bindings)))]
+ (list.reverse (list.pairs bindings)))]
(#.Right [state (list (case ?name
(#.Some name)
(let [name [location.dummy (#.Identifier ["" name])]]
diff --git a/stdlib/source/library/lux/abstract/monad.lux b/stdlib/source/library/lux/abstract/monad.lux
index e4d739638..b1f9847e7 100644
--- a/stdlib/source/library/lux/abstract/monad.lux
+++ b/stdlib/source/library/lux/abstract/monad.lux
@@ -34,11 +34,11 @@
#.End
xs))
-(def: (as_pairs xs)
+(def: (pairs xs)
(All [a] (-> (List a) (List [a a])))
(case xs
(#.Item x1 (#.Item x2 xs'))
- (#.Item [x1 x2] (as_pairs xs'))
+ (#.Item [x1 x2] (pairs xs'))
_
#.End))
@@ -91,7 +91,7 @@
(` (|> (~ value) ((~ g!map) (function ((~ g!_) (~ var)) (~ body'))) (~ g!join)))
))))
body
- (reverse (as_pairs bindings)))]
+ (reverse (pairs bindings)))]
(#.Right [state (list (case ?name
(#.Some name)
(let [name [location.dummy (#.Identifier ["" name])]]
diff --git a/stdlib/source/library/lux/control/concatenative.lux b/stdlib/source/library/lux/control/concatenative.lux
index 88ac4f0b9..9e3bfea18 100644
--- a/stdlib/source/library/lux/control/concatenative.lux
+++ b/stdlib/source/library/lux/control/concatenative.lux
@@ -90,16 +90,16 @@
(|> outputs (get@ #bottom) (maybe\map (|>> code.nat (~) #.Parameter (`))))]
[(#.Some bottomI) (#.Some bottomO)]
(monad.do meta.monad
- [inputC (singleton (macro.expand_all (stack_fold (get@ #top inputs) bottomI)))
- outputC (singleton (macro.expand_all (stack_fold (get@ #top outputs) bottomO)))]
+ [inputC (singleton (macro.full_expansion (stack_fold (get@ #top inputs) bottomI)))
+ outputC (singleton (macro.full_expansion (stack_fold (get@ #top outputs) bottomO)))]
(in (list (` (-> (~ (de_alias inputC))
(~ (de_alias outputC)))))))
[?bottomI ?bottomO]
(with_gensyms [g!stack]
(monad.do meta.monad
- [inputC (singleton (macro.expand_all (stack_fold (get@ #top inputs) (maybe.default g!stack ?bottomI))))
- outputC (singleton (macro.expand_all (stack_fold (get@ #top outputs) (maybe.default g!stack ?bottomO))))]
+ [inputC (singleton (macro.full_expansion (stack_fold (get@ #top inputs) (maybe.default g!stack ?bottomI))))
+ outputC (singleton (macro.full_expansion (stack_fold (get@ #top outputs) (maybe.default g!stack ?bottomO))))]
(in (list (` (All [(~ g!stack)]
(-> (~ (de_alias inputC))
(~ (de_alias outputC))))))))))))
diff --git a/stdlib/source/library/lux/control/concurrency/semaphore.lux b/stdlib/source/library/lux/control/concurrency/semaphore.lux
index fc6f939c8..ea575915c 100644
--- a/stdlib/source/library/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/library/lux/control/concurrency/semaphore.lux
@@ -161,7 +161,7 @@
[(def: (<phase> (^:representation barrier))
(-> Barrier (Async Any))
(do async.monad
- [#let [limit (refinement.un_refine (get@ #limit barrier))
+ [#let [limit (refinement.value (get@ #limit barrier))
goal <goal>
[_ count] (io.run (atom.update <update> (get@ #count barrier)))
reached? (n.= goal count)]]
diff --git a/stdlib/source/library/lux/control/parser.lux b/stdlib/source/library/lux/control/parser.lux
index d38044ec1..696ec7525 100644
--- a/stdlib/source/library/lux/control/parser.lux
+++ b/stdlib/source/library/lux/control/parser.lux
@@ -189,15 +189,14 @@
(at_most (dec amount) parser))
input')))))
-(def: #export (between from to parser)
- {#.doc "Parse between N and M times."}
+(def: #export (between minimum additional parser)
(All [s a] (-> Nat Nat (Parser s a) (Parser s (List a))))
(do {! ..monad}
- [minimum (..exactly from parser)]
- (if (n.< to from)
- (\ ! map (list\compose minimum)
- (..at_most (n.- from to) parser))
- (in minimum))))
+ [minimum (..exactly minimum parser)]
+ (case additional
+ 0 (in minimum)
+ _ (\ ! map (list\compose minimum)
+ (..at_most additional parser)))))
(def: #export (separated_by separator parser)
{#.doc "Parses instances of 'parser' that are separated by instances of 'separator'."}
diff --git a/stdlib/source/library/lux/control/parser/text.lux b/stdlib/source/library/lux/control/parser/text.lux
index aa4858f66..ce3aacdaf 100644
--- a/stdlib/source/library/lux/control/parser/text.lux
+++ b/stdlib/source/library/lux/control/parser/text.lux
@@ -322,7 +322,9 @@
[(def: #export (<name> amount parser)
{#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " N characters (as a slice)."))}
(-> Nat (Parser Text) (Parser Text))
- (|> parser (<base> amount) (\ //.monad map /.concat)))]
+ (|> parser
+ (<base> amount)
+ (\ //.monad map /.concat)))]
[exactly //.exactly "exactly"]
[at_most //.at_most "at most"]
@@ -333,22 +335,24 @@
[(def: #export (<name> amount parser)
{#.doc (code.text ($_ /\compose "Yields " <doc_modifier> " N characters (as a slice)."))}
(-> Nat (Parser Slice) (Parser Slice))
- (with_slices (<base> amount parser)))]
+ (with_slices
+ (<base> amount parser)))]
[exactly! //.exactly "exactly"]
[at_most! //.at_most "at most"]
[at_least! //.at_least "at least"]
)
-(def: #export (between from to parser)
- {#.doc "Yields between N and M characters."}
+(def: #export (between minimum additional parser)
(-> Nat Nat (Parser Text) (Parser Text))
- (|> parser (//.between from to) (\ //.monad map /.concat)))
+ (|> parser
+ (//.between minimum additional)
+ (\ //.monad map /.concat)))
-(def: #export (between! from to parser)
- {#.doc "Yields between N and M characters (as a slice)."}
+(def: #export (between! minimum additional parser)
(-> Nat Nat (Parser Slice) (Parser Slice))
- (with_slices (//.between from to parser)))
+ (with_slices
+ (//.between minimum additional parser)))
(def: #export (enclosed [start end] parser)
(All [a] (-> [Text Text] (Parser a) (Parser a)))
diff --git a/stdlib/source/library/lux/control/parser/tree.lux b/stdlib/source/library/lux/control/parser/tree.lux
index 11673474c..ad2015624 100644
--- a/stdlib/source/library/lux/control/parser/tree.lux
+++ b/stdlib/source/library/lux/control/parser/tree.lux
@@ -26,7 +26,7 @@
(def: #export (run parser tree)
{#.doc (doc "Applies the parser against a tree.")}
(All [t a] (-> (Parser t a) (Tree t) (Try a)))
- (run' parser (zipper.zip tree)))
+ (run' parser (zipper.zipper tree)))
(def: #export value
{#.doc (doc "Yields the value inside the current tree node.")}
diff --git a/stdlib/source/library/lux/control/state.lux b/stdlib/source/library/lux/control/state.lux
index 447b6428e..8d9d3116a 100644
--- a/stdlib/source/library/lux/control/state.lux
+++ b/stdlib/source/library/lux/control/state.lux
@@ -16,11 +16,11 @@
(function (_ state)
[state state]))
-(def: #export (put new-state)
+(def: #export (put new_state)
{#.doc "Set the new state."}
(All [s] (-> s (State s Any)))
(function (_ state)
- [new-state []]))
+ [new_state []]))
(def: #export (update change)
{#.doc "Compute the new state."}
diff --git a/stdlib/source/library/lux/control/thread.lux b/stdlib/source/library/lux/control/thread.lux
index ec2e48153..236ded86b 100644
--- a/stdlib/source/library/lux/control/thread.lux
+++ b/stdlib/source/library/lux/control/thread.lux
@@ -15,6 +15,7 @@
abstract]]])
(type: #export (Thread ! a)
+ {#.doc (doc "An imperative process with access to mutable values.")}
(-> ! a))
(abstract: #export (Box t v)
@@ -23,6 +24,7 @@
{#.doc "A mutable box holding a value."}
(def: #export (box init)
+ {#.doc (doc "A brand-new box initialized to the given value.")}
(All [a] (-> a (All [!] (Thread ! (Box ! a)))))
(function (_ !)
(|> (array.new 1)
@@ -30,6 +32,7 @@
:abstraction)))
(def: #export (read box)
+ {#.doc (doc "Reads the current value in the box.")}
(All [! a] (-> (Box ! a) (Thread ! a)))
(function (_ !)
(for {@.old
@@ -51,18 +54,21 @@
@.scheme ("scheme array read" 0 (:representation box))})))
(def: #export (write value box)
+ {#.doc (doc "Mutates the value in the box.")}
(All [a] (-> a (All [!] (-> (Box ! a) (Thread ! Any)))))
(function (_ !)
(|> box :representation (array.write! 0 value) :abstraction)))
)
(def: #export (run thread)
+ {#.doc (doc "Executes the imperative thread in a self-contained way.")}
(All [a]
(-> (All [!] (Thread ! a))
a))
(thread []))
(def: #export io
+ {#.doc (doc "Transforms the imperative thread into an I/O computation.")}
(All [a]
(-> (All [!] (Thread ! a))
(IO a)))
@@ -99,7 +105,8 @@
((ffa !) !))))
(def: #export (update f box)
- (All [a] (-> (-> a a) (All [!] (-> (Box ! a) (Thread ! a)))))
+ {#.doc (doc "Update a box's value by applying a function to it.")}
+ (All [a !] (-> (-> a a) (Box ! a) (Thread ! a)))
(do ..monad
[old (read box)
_ (write (f old) box)]
diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux
index 52f58495a..4a6a35678 100644
--- a/stdlib/source/library/lux/control/try.lux
+++ b/stdlib/source/library/lux/control/try.lux
@@ -10,6 +10,7 @@
["." location]]]])
(type: #export (Try a)
+ {#.doc (doc "A computation that can fail with an error message.")}
(#Failure Text)
(#Success a))
@@ -59,12 +60,16 @@
ma)))
(implementation: #export (with monad)
- ## TODO: Replace (All [a] (M (Try a))) with (functor.Then M Try)
- (All [M] (-> (Monad M) (Monad (All [a] (M (Try a))))))
+ {#.doc (doc "Enhances a monad with error-handling functionality.")}
+ ## TODO: Replace (All [a] (! (Try a))) with (functor.Then ! Try)
+ (All [!] (-> (Monad !) (Monad (All [a] (! (Try a))))))
- (def: &functor (functor.compose (get@ #monad.&functor monad) ..functor))
+ (def: &functor
+ (functor.compose (get@ #monad.&functor monad) ..functor))
- (def: in (|>> (\ ..monad in) (\ monad in)))
+ (def: in
+ (|>> (\ ..monad in)
+ (\ monad in)))
(def: (join MeMea)
(do monad
@@ -77,7 +82,8 @@
Mea))))
(def: #export (lifted monad)
- (All [M a] (-> (Monad M) (-> (M a) (M (Try a)))))
+ {#.doc (doc "Wraps a monadic value with error-handling machinery.")}
+ (All [! a] (-> (Monad !) (-> (! a) (! (Try a)))))
(\ monad map (\ ..monad in)))
(implementation: #export (equivalence (^open "_\."))
@@ -96,6 +102,8 @@
)))
(def: #export (assumed try)
+ {#.doc (doc "Assumes a Try value succeeded."
+ "If it didn't, raises the error as a runtime error.")}
(All [a] (-> (Try a) a))
(case try
(#Success value)
diff --git a/stdlib/source/library/lux/control/writer.lux b/stdlib/source/library/lux/control/writer.lux
index 8fd8e9492..066b4ef58 100644
--- a/stdlib/source/library/lux/control/writer.lux
+++ b/stdlib/source/library/lux/control/writer.lux
@@ -51,6 +51,7 @@
[(\ monoid compose log1 log2) a])))
(implementation: #export (with monoid monad)
+ {#.doc (doc "Enhances a monad with Writer functionality.")}
(All [l M] (-> (Monoid l) (Monad M) (Monad (All [a] (M (Writer l a))))))
(def: &functor
@@ -72,6 +73,7 @@
(in [(\ monoid compose l1 l2) a]))))
(def: #export (lift monoid monad)
+ {#.doc (doc "Wraps a monadic value with Writer machinery.")}
(All [l M a]
(-> (Monoid l) (Monad M)
(-> (M a) (M (Writer l a)))))
diff --git a/stdlib/source/library/lux/data/collection/array.lux b/stdlib/source/library/lux/data/collection/array.lux
index c1b5cd7bc..96b082211 100644
--- a/stdlib/source/library/lux/data/collection/array.lux
+++ b/stdlib/source/library/lux/data/collection/array.lux
@@ -36,6 +36,7 @@
(as_is))
(def: #export (new size)
+ {#.doc (doc "An empty array of the specified size.")}
(All [a] (-> Nat (Array a)))
(for {@.old
(:assume ("jvm anewarray" "(java.lang.Object )" size))
@@ -108,6 +109,7 @@
#.None))
(def: #export (write! index value array)
+ {#.doc (doc "Mutate the array by writing a value to the specified index.")}
(All [a]
(-> Nat a (Array a) (Array a)))
(for {@.old
@@ -127,6 +129,7 @@
@.scheme ("scheme array write" index value array)}))
(def: #export (delete! index array)
+ {#.doc (doc "Mutate the array by deleting the value at the specified index.")}
(All [a]
(-> Nat (Array a) (Array a)))
(if (n.< (size array) index)
@@ -156,6 +159,7 @@
false))
(def: #export (update! index transform array)
+ {#.doc (doc "Mutate the array by updating the value at the specified index.")}
(All [a]
(-> Nat (-> a a) (Array a) (Array a)))
(case (read index array)
@@ -166,6 +170,8 @@
(write! index (transform value) array)))
(def: #export (upsert! index default transform array)
+ {#.doc (doc "Mutate the array by updating the value at the specified index."
+ "If there is no value, update and write the default value given.")}
(All [a]
(-> Nat a (-> a a) (Array a) (Array a)))
(write! index
@@ -173,6 +179,7 @@
array))
(def: #export (copy! length src_start src_array dest_start dest_array)
+ {#.doc (doc "Writes the contents of one array into the other.")}
(All [a]
(-> Nat Nat (Array a) Nat (Array a)
(Array a)))
@@ -207,6 +214,7 @@
(n.- (..occupancy array) (..size array)))
(def: #export (filter! p xs)
+ {#.doc (doc "Delete every item of the array that fails to satisfy the predicate.")}
(All [a]
(-> (Predicate a) (Array a) (Array a)))
(list\fold (function (_ idx xs')
@@ -222,6 +230,7 @@
(list.indices (size xs))))
(def: #export (find p xs)
+ {#.doc (doc "Yields the first item in the array that satisfies the predicate.")}
(All [a]
(-> (Predicate a) (Array a) (Maybe a)))
(let [arr_size (size xs)]
@@ -255,6 +264,7 @@
#.None))))
(def: #export (clone xs)
+ {#.doc (doc "Yields a shallow clone of the array.")}
(All [a] (-> (Array a) (Array a)))
(let [arr_size (size xs)]
(list\fold (function (_ idx ys)
@@ -274,9 +284,12 @@
[0 (new (list.size xs))]
xs)))
-(def: underflow Nat (dec 0))
+(def: underflow
+ Nat
+ (dec 0))
(def: #export (to_list array)
+ {#.doc (doc "Yields a list with every non-empty item in the array.")}
(All [a] (-> (Array a) (List a)))
(loop [idx (dec (size array))
output #.End]
@@ -291,6 +304,7 @@
output)))))
(def: #export (to_list' default array)
+ {#.doc (doc "Like 'to_list', but uses the 'default' value when encountering an empty cell in the array.")}
(All [a] (-> a (Array a) (List a)))
(loop [idx (dec (size array))
output #.End]
@@ -368,20 +382,21 @@
so_far)))))
(template [<name> <init> <op>]
- [(def: #export (<name> predicate array)
+ [(def: #export (<name> predicate)
(All [a]
(-> (Predicate a) (Predicate (Array a))))
- (let [size (..size array)]
- (loop [idx 0]
- (if (n.< size idx)
- (case (..read idx array)
- (#.Some value)
- (<op> (predicate value)
- (recur (inc idx)))
-
- #.None
- (recur (inc idx)))
- <init>))))]
+ (function (_ array)
+ (let [size (..size array)]
+ (loop [idx 0]
+ (if (n.< size idx)
+ (case (..read idx array)
+ (#.Some value)
+ (<op> (predicate value)
+ (recur (inc idx)))
+
+ #.None
+ (recur (inc idx)))
+ <init>)))))]
[every? true and]
[any? false or]
diff --git a/stdlib/source/library/lux/data/collection/bits.lux b/stdlib/source/library/lux/data/collection/bits.lux
index c90cff48c..6066bd0c2 100644
--- a/stdlib/source/library/lux/data/collection/bits.lux
+++ b/stdlib/source/library/lux/data/collection/bits.lux
@@ -21,6 +21,7 @@
i64.width)
(type: #export Bits
+ {#.doc (doc "A bit-map.")}
(Array Chunk))
(def: empty_chunk
@@ -32,6 +33,7 @@
(array.new 0))
(def: #export (size bits)
+ {#.doc (doc "Measures the size of a bit-map by counting all the 1s in the bit-map.")}
(-> Bits Nat)
(array\fold (function (_ chunk total)
(|> chunk i64.count (n.+ total)))
@@ -44,7 +46,7 @@
(def: #export empty?
(-> Bits Bit)
- (|>> size (n.= 0)))
+ (|>> ..size (n.= 0)))
(def: #export (get index bits)
(-> Nat Bits Bit)
diff --git a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
index fcac55d8a..0b8976411 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/ordered.lux
@@ -11,7 +11,8 @@
[collection
["." list ("#\." monoid fold)]]]
[macro
- ["." code]]
+ ["." code]
+ ["." template]]
[math
[number
["n" nat]]]]])
@@ -44,10 +45,12 @@
)
(type: #export (Dictionary k v)
+ {#.doc (doc "A dictionary data-structure with ordered entries.")}
{#&order (Order k)
#root (Maybe (Node k v))})
(def: #export (new order)
+ {#.doc (doc "An empty dictionary, employing the given order.")}
(All [k v] (-> (Order k) (Dictionary k v)))
{#&order order
#root #.None})
@@ -99,6 +102,7 @@
(template [<name> <side>]
[(def: #export (<name> dict)
+ {#.doc (doc (~~ (template.text ["Yields value under the " <name> "imum key."])))}
(All [k v] (-> (Dictionary k v) (Maybe v)))
(case (get@ #root dict)
#.None
@@ -538,11 +542,11 @@
#.None
dict))
-(def: #export (of_list Order<l> list)
+(def: #export (of_list order list)
(All [k v] (-> (Order k) (List [k v]) (Dictionary k v)))
(list\fold (function (_ [key value] dict)
(put key value dict))
- (new Order<l>)
+ (new order)
list))
(template [<name> <type> <output>]
diff --git a/stdlib/source/library/lux/data/collection/dictionary/plist.lux b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
index ac7cbcf6f..03025db7e 100644
--- a/stdlib/source/library/lux/data/collection/dictionary/plist.lux
+++ b/stdlib/source/library/lux/data/collection/dictionary/plist.lux
@@ -12,7 +12,10 @@
[number
["n" nat]]]]])
+## https://en.wikipedia.org/wiki/Property_list
(type: #export (PList a)
+ {#.doc (doc "A property list."
+ "It's a simple dictionary-like structure with Text keys.")}
(List [Text a]))
(def: #export empty
diff --git a/stdlib/source/library/lux/data/collection/list.lux b/stdlib/source/library/lux/data/collection/list.lux
index feaebb373..ee500594b 100644
--- a/stdlib/source/library/lux/data/collection/list.lux
+++ b/stdlib/source/library/lux/data/collection/list.lux
@@ -75,13 +75,13 @@
[(#.Item head in) out]
[in (#.Item head out)]))))
-(def: #export (as_pairs xs)
+(def: #export (pairs xs)
{#.doc (doc "Cut the list into pairs of 2."
- "Caveat emptor: If the list has an uneven number of elements, the last one will be skipped.")}
+ "Caveat emptor: If the list has an un-even number of elements, the last one will be skipped.")}
(All [a] (-> (List a) (List [a a])))
(case xs
(^ (list& x1 x2 xs'))
- (#.Item [x1 x2] (as_pairs xs'))
+ (#.Item [x1 x2] (pairs xs'))
_
#.End))
diff --git a/stdlib/source/library/lux/data/collection/queue/priority.lux b/stdlib/source/library/lux/data/collection/queue/priority.lux
index 0b25c11fe..8f0a788fc 100644
--- a/stdlib/source/library/lux/data/collection/queue/priority.lux
+++ b/stdlib/source/library/lux/data/collection/queue/priority.lux
@@ -18,8 +18,13 @@
(type: #export Priority
Nat)
-(def: #export max Priority n\top)
-(def: #export min Priority n\bottom)
+(def: #export max
+ Priority
+ n\top)
+
+(def: #export min
+ Priority
+ n\bottom)
(def: builder
(tree.builder n.maximum))
diff --git a/stdlib/source/library/lux/data/collection/set/multi.lux b/stdlib/source/library/lux/data/collection/set/multi.lux
index 14ee02181..155217b81 100644
--- a/stdlib/source/library/lux/data/collection/set/multi.lux
+++ b/stdlib/source/library/lux/data/collection/set/multi.lux
@@ -22,6 +22,8 @@
(abstract: #export (Set a)
(Dictionary a Nat)
+ {#.doc (doc "A set that keeps track of repetition in its entries.")}
+
(def: #export new
(All [a] (-> (Hash a) (Set a)))
(|>> dictionary.new :abstraction))
@@ -94,6 +96,7 @@
subject)))
(def: #export (sub? reference subject)
+ {#.doc (doc "Is 'subject' a sub-set of 'reference'?")}
(All [a] (-> (Set a) (Set a) Bit))
(|> subject
:representation
@@ -104,6 +107,7 @@
(n.>= multiplicity))))))
(def: #export (support set)
+ {#.doc (doc "A set of the unique (non repeated) members.")}
(All [a] (-> (Set a) (//.Set a)))
(let [(^@ set [hash _]) (:representation set)]
(|> set
@@ -154,5 +158,6 @@
(//.to_list subject)))
(def: #export super?
+ {#.doc (doc "Is 'subject' a super-set of 'reference'?")}
(All [a] (-> (Set a) (Set a) Bit))
(function.flip sub?))
diff --git a/stdlib/source/library/lux/data/collection/set/ordered.lux b/stdlib/source/library/lux/data/collection/set/ordered.lux
index e53e3398e..fbe72bada 100644
--- a/stdlib/source/library/lux/data/collection/set/ordered.lux
+++ b/stdlib/source/library/lux/data/collection/set/ordered.lux
@@ -15,6 +15,8 @@
(abstract: #export (Set a)
(/.Dictionary a a)
+ {#.doc (doc "A set with ordered entries.")}
+
(def: #export new
(All [a] (-> (Order a) (Set a)))
(|>> /.new :abstraction))
@@ -75,11 +77,13 @@
)
(def: #export (sub? super sub)
+ {#.doc (doc "Is 'sub' a sub-set of 'super'?")}
(All [a] (-> (Set a) (Set a) Bit))
(|> sub
..to_list
(list.every? (..member? super))))
(def: #export (super? sub super)
+ {#.doc (doc "Is 'super' a super-set of 'sub'?")}
(All [a] (-> (Set a) (Set a) Bit))
(sub? super sub))
diff --git a/stdlib/source/library/lux/data/collection/tree/finger.lux b/stdlib/source/library/lux/data/collection/tree/finger.lux
index 1e986da40..be444ba1a 100644
--- a/stdlib/source/library/lux/data/collection/tree/finger.lux
+++ b/stdlib/source/library/lux/data/collection/tree/finger.lux
@@ -10,13 +10,17 @@
[type
[abstract (#+ abstract: :abstraction :representation)]]]])
+## https://en.wikipedia.org/wiki/Finger_tree
(abstract: #export (Tree @ t v)
{#monoid (Monoid t)
#tag t
#root (| v
[(Tree @ t v) (Tree @ t v)])}
+ {#.doc (doc "A finger tree.")}
+
(interface: #export (Builder @ t)
+ {#.doc (doc "A builder for finter tree structures.")}
(: (All [v]
(-> t v (Tree @ t v)))
leaf)
@@ -36,6 +40,7 @@
)
(implementation: #export (builder monoid)
+ {#.doc (doc "A new builder using the given monoid.")}
(All [t] (Ex [@] (-> (Monoid t) (Builder @ t))))
(def: (leaf tag value)
@@ -80,6 +85,7 @@
(values right))))
(def: #export (one predicate tree)
+ {#.doc (doc "Finds one value that meets the predicate.")}
(All [@ t v] (-> (Predicate t) (Tree @ t v) (Maybe v)))
(let [[monoid tag root] (:representation tree)]
(if (predicate tag)
@@ -99,6 +105,7 @@
)
(def: #export (exists? predicate tree)
+ {#.doc (doc "Verifies that a value exists which meets the predicate.")}
(All [@ t v] (-> (Predicate t) (Tree @ t v) Bit))
(case (..one predicate tree)
(#.Some _)
diff --git a/stdlib/source/library/lux/data/collection/tree/zipper.lux b/stdlib/source/library/lux/data/collection/tree/zipper.lux
index 998b75c3e..4c1def087 100644
--- a/stdlib/source/library/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/library/lux/data/collection/tree/zipper.lux
@@ -21,6 +21,7 @@
#lefts (List (Tree a))
#rights (List (Tree a))})
+## https://en.wikipedia.org/wiki/Zipper_(data_structure)
(type: #export (Zipper a)
{#.doc "Tree zippers, for easy navigation and editing of trees."}
{#family (Maybe (Family Zipper a))
@@ -41,12 +42,12 @@
(//.equivalence super))]
(== reference sample))))
-(def: #export (zip tree)
+(def: #export (zipper tree)
(All [a] (-> (Tree a) (Zipper a)))
{#family #.None
#node tree})
-(def: #export unzip
+(def: #export tree
(All [a] (-> (Zipper a) (Tree a)))
(get@ #node))
@@ -54,13 +55,13 @@
(All [a] (-> (Zipper a) a))
(get@ [#node #//.value]))
-(def: #export set
+(def: #export (set value zipper)
(All [a] (-> a (Zipper a) (Zipper a)))
- (set@ [#node #//.value]))
+ (set@ [#node #//.value] value zipper))
-(def: #export update
+(def: #export (update transform zipper)
(All [a] (-> (-> a a) (Zipper a) (Zipper a)))
- (update@ [#node #//.value]))
+ (update@ [#node #//.value] transform zipper))
(def: children
(All [a] (-> (Zipper a) (List (Tree a))))
@@ -306,7 +307,7 @@
(def: (split (^slots [#family #node]))
(let [tree_splitter (: (All [a] (-> (Tree a) (Tree (Zipper a))))
(function (tree_splitter tree)
- {#//.value (..zip tree)
+ {#//.value (..zipper tree)
#//.children (|> tree
(get@ #//.children)
(list\map tree_splitter))}))]
diff --git a/stdlib/source/library/lux/data/format/css.lux b/stdlib/source/library/lux/data/format/css.lux
index d94f97cd9..f2f991da2 100644
--- a/stdlib/source/library/lux/data/format/css.lux
+++ b/stdlib/source/library/lux/data/format/css.lux
@@ -43,7 +43,7 @@
(-> Encoding (CSS Special))
(|>> encoding.name
%.text
- (text.enclose ["@charset " ";"])
+ (text.enclosed ["@charset " ";"])
:abstraction))
(def: #export (font font)
@@ -65,7 +65,7 @@
(list\map (function (_ [property value])
(format property ": " value ";")))
(text.join_with /style.separator)
- (text.enclose ["{" "}"])
+ (text.enclosed ["{" "}"])
(format "@font-face")
:abstraction)))
diff --git a/stdlib/source/library/lux/data/format/css/selector.lux b/stdlib/source/library/lux/data/format/css/selector.lux
index 330f6a907..08f2165da 100644
--- a/stdlib/source/library/lux/data/format/css/selector.lux
+++ b/stdlib/source/library/lux/data/format/css/selector.lux
@@ -151,14 +151,14 @@
(-> Locale (Selector Can_Chain))
(|> locale
locale.code
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
(format ":lang")
:abstraction))
(def: #export not
(-> (Selector Any) (Selector Can_Chain))
(|>> :representation
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
(format ":not")
:abstraction))
@@ -192,7 +192,7 @@
[(def: #export (<name> index)
(-> Index (Selector Can_Chain))
(|> (:representation index)
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
(format <pseudo>)
(:abstraction Selector)))]
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux
index 1b69f1496..e49c06687 100644
--- a/stdlib/source/library/lux/data/format/css/value.lux
+++ b/stdlib/source/library/lux/data/format/css/value.lux
@@ -783,7 +783,7 @@
(-> Text (List Text) Value)
(|> inputs
(text.join_with ..value_separator)
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
(format name)
:abstraction))
@@ -1199,7 +1199,7 @@
(|>> (list\map (|>> (list\map (|>> (maybe.default empty)
:representation))
(text.join_with ..grid_column_separator)
- (text.enclose ["'" "'"])))
+ (text.enclosed ["'" "'"])))
(text.join_with ..grid_row_separator)
:abstraction)))
diff --git a/stdlib/source/library/lux/data/format/html.lux b/stdlib/source/library/lux/data/format/html.lux
index a96a6df84..419096680 100644
--- a/stdlib/source/library/lux/data/format/html.lux
+++ b/stdlib/source/library/lux/data/format/html.lux
@@ -70,11 +70,11 @@
(|> attributes
..attributes
(format tag " ")
- (text.enclose ["<" ">"])))
+ (text.enclosed ["<" ">"])))
(def: close
(-> Tag Text)
- (text.enclose ["</" ">"]))
+ (text.enclosed ["</" ">"]))
(abstract: #export (HTML brand)
Text
@@ -127,7 +127,7 @@
(def: #export (comment content node)
(All [brand] (-> Text (HTML brand) (HTML brand)))
(:abstraction
- (format (text.enclose ["<!--" "-->"] content)
+ (format (text.enclosed ["<!--" "-->"] content)
(:representation node))))
(def: (empty name attributes)
diff --git a/stdlib/source/library/lux/data/format/json.lux b/stdlib/source/library/lux/data/format/json.lux
index 417e7791d..8f3293e56 100644
--- a/stdlib/source/library/lux/data/format/json.lux
+++ b/stdlib/source/library/lux/data/format/json.lux
@@ -234,7 +234,7 @@
(def: string_format
(-> String Text)
(|>> (text.replace_all text.double_quote ..escaped_dq)
- (text.enclose [text.double_quote text.double_quote])))
+ (text.enclosed [text.double_quote text.double_quote])))
(template [<token> <name>]
[(def: <name>
@@ -256,7 +256,7 @@
(|>> (row\map format)
row.to_list
(text.join_with ..separator)
- (text.enclose [..open_array ..close_array])))
+ (text.enclosed [..open_array ..close_array])))
(def: (kv_format format [key value])
(-> (-> JSON Text) (-> [String JSON] Text))
@@ -271,7 +271,7 @@
(|>> dictionary.entries
(list\map (..kv_format format))
(text.join_with ..separator)
- (text.enclose [..open_object ..close_object])))
+ (text.enclosed [..open_object ..close_object])))
(def: #export (format json)
(-> JSON Text)
diff --git a/stdlib/source/library/lux/data/format/markdown.lux b/stdlib/source/library/lux/data/format/markdown.lux
index 68af40458..2fbef2fa0 100644
--- a/stdlib/source/library/lux/data/format/markdown.lux
+++ b/stdlib/source/library/lux/data/format/markdown.lux
@@ -77,7 +77,7 @@
[(def: #export <name>
(-> (Markdown Span) (Markdown Span))
(|>> :representation
- (text.enclose [<wrapper> <wrapper>])
+ (text.enclosed [<wrapper> <wrapper>])
:abstraction))]
[bold "**"]
@@ -111,7 +111,7 @@
(format (%.nat (inc idx)) ". " (:representation summary) text.new_line
(case detail
(#.Some detail)
- (|> detail :representation ..indent (text.enclose [text.new_line text.new_line]))
+ (|> detail :representation ..indent (text.enclosed [text.new_line text.new_line]))
#.None
""))))
@@ -125,7 +125,7 @@
(format "*. " (:representation summary) text.new_line
(case detail
(#.Some detail)
- (|> detail :representation ..indent (text.enclose [text.new_line text.new_line]))
+ (|> detail :representation ..indent (text.enclosed [text.new_line text.new_line]))
#.None
""))))
@@ -135,14 +135,14 @@
(def: #export snippet
{#.doc "A snippet of code."}
(-> Text (Markdown Span))
- (|>> ..safe (text.enclose ["`" "`"]) :abstraction))
+ (|>> ..safe (text.enclosed ["`" "`"]) :abstraction))
(def: #export code
{#.doc "A block of code."}
(-> Text (Markdown Block))
(let [open (format "```" text.new_line)
close (format text.new_line "```")]
- (|>> (text.enclose [open close]) ..block)))
+ (|>> (text.enclosed [open close]) ..block)))
(def: #export (image description url)
(-> Text URL (Markdown Span))
@@ -162,7 +162,7 @@
(template [<name> <type>]
[(def: #export <name>
(-> <type> (Markdown Span))
- (|>> (text.enclose ["<" ">"]) :abstraction))]
+ (|>> (text.enclosed ["<" ">"]) :abstraction))]
[url URL]
[email Email]
diff --git a/stdlib/source/library/lux/data/format/tar.lux b/stdlib/source/library/lux/data/format/tar.lux
index d216a1ef8..d5dad8d9b 100644
--- a/stdlib/source/library/lux/data/format/tar.lux
+++ b/stdlib/source/library/lux/data/format/tar.lux
@@ -8,7 +8,7 @@
["." try (#+ Try)]
["." exception (#+ exception:)]
["<>" parser
- ["<b>" binary (#+ Parser)]]]
+ ["<.>" binary (#+ Parser)]]]
[data
["." product]
["." binary (#+ Binary)]
@@ -100,11 +100,11 @@
[not_a_small_number small_limit ..small_size
Small small from_small
small_writer (format ..blank ..null)
- coerce_small]
+ as_small]
[not_a_big_number big_limit ..big_size
Big big from_big
big_writer ..blank
- coerce_big]
+ as_big]
)
(exception: #export (wrong_character {expected Char} {actual Char})
@@ -115,8 +115,8 @@
(def: verify_small_suffix
(Parser Any)
(do <>.monad
- [pre_end <b>.bits/8
- end <b>.bits/8
+ [pre_end <binary>.bits/8
+ end <binary>.bits/8
_ (let [expected (`` (char (~~ (static ..blank))))]
(<>.assert (exception.construct ..wrong_character [expected pre_end])
(n.= expected pre_end)))
@@ -128,7 +128,7 @@
(def: small_parser
(Parser Small)
(do <>.monad
- [digits (<b>.segment ..small_size)
+ [digits (<binary>.segment ..small_size)
digits (<>.lift (\ utf8.codec decode digits))
_ ..verify_small_suffix]
(<>.lift
@@ -139,9 +139,9 @@
(def: big_parser
(Parser Big)
(do <>.monad
- [digits (<b>.segment ..big_size)
+ [digits (<binary>.segment ..big_size)
digits (<>.lift (\ utf8.codec decode digits))
- end <b>.bits/8
+ end <binary>.bits/8
_ (let [expected (`` (char (~~ (static ..blank))))]
(<>.assert (exception.construct ..wrong_character [expected end])
(n.= expected end)))]
@@ -177,7 +177,7 @@
(def: checksum_code
(-> Binary Checksum)
(|>> ..checksum
- ..coerce_small
+ ..as_small
..from_small
(\ n.octal encode)
(..octal_padding ..small_size)
@@ -195,7 +195,7 @@
(def: checksum_parser
(Parser [Nat Checksum])
(do <>.monad
- [ascii (<b>.segment ..small_size)
+ [ascii (<binary>.segment ..small_size)
digits (<>.lift (\ utf8.codec decode ascii))
_ ..verify_small_suffix
value (<>.lift
@@ -273,8 +273,8 @@
(def: <parser>
(Parser <type>)
(do <>.monad
- [string (<b>.segment <size>)
- end <b>.bits/8
+ [string (<binary>.segment <size>)
+ end <binary>.bits/8
#let [expected (`` (char (~~ (static ..null))))]
_ (<>.assert (exception.construct ..wrong_character [expected end])
(n.= expected end))]
@@ -315,8 +315,8 @@
(def: magic_parser
(Parser Magic)
(do <>.monad
- [string (<b>.segment ..magic_size)
- end <b>.bits/8
+ [string (<binary>.segment ..magic_size)
+ end <binary>.bits/8
#let [expected (`` (char (~~ (static ..null))))]
_ (<>.assert (exception.construct ..wrong_character [expected end])
(n.= expected end))]
@@ -417,7 +417,7 @@
(def: link_flag_parser
(Parser Link_Flag)
(do <>.monad
- [linkflag <b>.bits/8]
+ [linkflag <binary>.bits/8]
(case (.nat linkflag)
(^template [<value> <link_flag>]
[(^ <value>)
@@ -540,7 +540,7 @@
(def: #export no_id
ID
- (..coerce_small 0))
+ (..as_small 0))
(type: #export Owner
{#name Name
@@ -638,7 +638,7 @@
(|>> instant.relative
(duration.query duration.second)
.nat
- ..coerce_big))
+ ..as_big))
(def: (file_writer link_flag)
(-> Link_Flag (Writer File))
@@ -678,8 +678,8 @@
#mode ..none
#user_id ..no_id
#group_id ..no_id
- #size (..coerce_big 0)
- #modification_time (..coerce_big 0)
+ #size (..as_big 0)
+ #modification_time (..as_big 0)
#checksum ..dummy_checksum
#link_flag ..symbolic_link
#link_name path
@@ -696,8 +696,8 @@
#mode ..none
#user_id ..no_id
#group_id ..no_id
- #size (..coerce_big 0)
- #modification_time (..coerce_big 0)
+ #size (..as_big 0)
+ #modification_time (..as_big 0)
#checksum ..dummy_checksum
#link_flag ..directory
#link_name ..no_path
@@ -753,7 +753,7 @@
(def: header_parser
(Parser Header)
(do <>.monad
- [binary_header (<>.speculative (<b>.segment block_size))
+ [binary_header (<>.speculative (<binary>.segment block_size))
path ..path_parser
mode ..mode_parser
user_id ..small_parser
@@ -772,7 +772,7 @@
group_name ..name_parser
major_device ..small_parser
minor_device ..small_parser
- _ (<b>.segment ..header_padding_size)]
+ _ (<binary>.segment ..header_padding_size)]
(in {#path path
#mode mode
#user_id user_id
@@ -801,9 +801,9 @@
(is? expected (get@ #link_flag header)))
#let [size (get@ #size header)
rounded_size (..rounded_content_size size)]
- content (<b>.segment (..from_big size))
+ content (<binary>.segment (..from_big size))
content (<>.lift (..content content))
- _ (<b>.segment (n.- (..from_big size) rounded_size))]
+ _ (<binary>.segment (n.- (..from_big size) rounded_size))]
(in [(get@ #path header)
(|> header
(get@ #modification_time)
@@ -847,7 +847,7 @@
(def: end_of_archive_block_parser
(Parser Any)
(do <>.monad
- [block (<b>.segment ..block_size)]
+ [block (<binary>.segment ..block_size)]
(let [actual (..checksum block)]
(<>.lift
(exception.assert ..wrong_checksum [0 actual]
@@ -859,7 +859,7 @@
(Parser Any)
(do <>.monad
[_ (<>.at_most 2 end_of_archive_block_parser)
- done? <b>.end?]
+ done? <binary>.end?]
(<>.lift
(exception.assert ..invalid_end_of_archive []
done?))))
diff --git a/stdlib/source/library/lux/data/text.lux b/stdlib/source/library/lux/data/text.lux
index 1ab453032..d9abb0f48 100644
--- a/stdlib/source/library/lux/data/text.lux
+++ b/stdlib/source/library/lux/data/text.lux
@@ -108,7 +108,7 @@
_
false))
-(def: #export (encloses? boundary value)
+(def: #export (enclosed_by? boundary value)
(-> Text Text Bit)
(and (starts_with? boundary value)
(ends_with? boundary value)))
@@ -130,19 +130,19 @@
(-> Text Text Text)
("lux text concat" subject param))
-(def: #export (enclose [left right] content)
+(def: #export (enclosed [left right] content)
{#.doc "Surrounds the given content text with left and right side additions."}
(-> [Text Text] Text Text)
($_ "lux text concat" left content right))
-(def: #export (enclose' boundary content)
+(def: #export (enclosed' boundary content)
{#.doc "Surrounds the given content text with the same boundary text."}
(-> Text Text Text)
- (enclose [boundary boundary] content))
+ (enclosed [boundary boundary] content))
(def: #export format
(-> Text Text)
- (..enclose' ..double_quote))
+ (..enclosed' ..double_quote))
(def: #export (clip offset characters input)
(-> Nat Nat Text (Maybe Text))
diff --git a/stdlib/source/library/lux/data/text/format.lux b/stdlib/source/library/lux/data/text/format.lux
index 5b59cf98a..cf4b3e2d4 100644
--- a/stdlib/source/library/lux/data/text/format.lux
+++ b/stdlib/source/library/lux/data/text/format.lux
@@ -122,7 +122,7 @@
(All [a] (-> (Format a) (Format (List a))))
(|>> (list\map (|>> formatter (format " ")))
(text.join_with "")
- (text.enclose ["(list" ")"])))
+ (text.enclosed ["(list" ")"])))
(def: #export (maybe format)
(All [a] (-> (Format a) (Format (Maybe a))))
diff --git a/stdlib/source/library/lux/data/text/regex.lux b/stdlib/source/library/lux/data/text/regex.lux
index 63aca69fb..691fccad7 100644
--- a/stdlib/source/library/lux/data/text/regex.lux
+++ b/stdlib/source/library/lux/data/text/regex.lux
@@ -6,9 +6,10 @@
monad]
[control
["." try]
+ ["." exception (#+ exception:)]
["<>" parser ("#\." monad)
- ["<t>" text (#+ Parser)]
- ["<c>" code]]]
+ ["<.>" text (#+ Parser)]
+ ["<.>" code]]]
[data
["." product]
["." maybe]
@@ -25,31 +26,31 @@
(def: regex_char^
(Parser Text)
- (<t>.none_of "\.|&()[]{}"))
+ (<text>.none_of "\.|&()[]{}"))
(def: escaped_char^
(Parser Text)
(do <>.monad
- [? (<>.parses? (<t>.this "\"))]
+ [? (<>.parses? (<text>.this "\"))]
(if ?
- <t>.any
+ <text>.any
regex_char^)))
(def: (refine^ refinement^ base^)
(All [a] (-> (Parser a) (Parser Text) (Parser Text)))
(do <>.monad
[output base^
- _ (<t>.local output refinement^)]
+ _ (<text>.local output refinement^)]
(in output)))
(def: word^
(Parser Text)
- (<>.either <t>.alpha_num
- (<t>.one_of "_")))
+ (<>.either <text>.alpha_num
+ (<text>.one_of "_")))
(def: (copy reference)
(-> Text (Parser Text))
- (<>.after (<t>.this reference) (<>\in reference)))
+ (<>.after (<text>.this reference) (<>\in reference)))
(def: (join_text^ part^)
(-> (Parser (List Text)) (Parser Text))
@@ -59,37 +60,37 @@
(def: name_char^
(Parser Text)
- (<t>.none_of (format "[]{}()s#.<>" //.double_quote)))
+ (<text>.none_of (format "[]{}()s#.<>" //.double_quote)))
(def: name_part^
(Parser Text)
(do <>.monad
- [head (refine^ (<t>.not <t>.decimal)
+ [head (refine^ (<text>.not <text>.decimal)
name_char^)
- tail (<t>.some name_char^)]
+ tail (<text>.some name_char^)]
(in (format head tail))))
(def: (name^ current_module)
(-> Text (Parser Name))
($_ <>.either
- (<>.and (<>\in current_module) (<>.after (<t>.this "..") name_part^))
- (<>.and name_part^ (<>.after (<t>.this ".") name_part^))
- (<>.and (<>\in .prelude_module) (<>.after (<t>.this ".") name_part^))
+ (<>.and (<>\in current_module) (<>.after (<text>.this "..") name_part^))
+ (<>.and name_part^ (<>.after (<text>.this ".") name_part^))
+ (<>.and (<>\in .prelude_module) (<>.after (<text>.this ".") name_part^))
(<>.and (<>\in "") name_part^)))
(def: (re_var^ current_module)
(-> Text (Parser Code))
(do <>.monad
- [name (<t>.enclosed ["\@<" ">"] (name^ current_module))]
+ [name (<text>.enclosed ["\@<" ">"] (name^ current_module))]
(in (` (: (Parser Text) (~ (code.identifier name)))))))
(def: re_range^
(Parser Code)
(do {! <>.monad}
[from (|> regex_char^ (\ ! map (|>> (//.nth 0) maybe.assume)))
- _ (<t>.this "-")
+ _ (<text>.this "-")
to (|> regex_char^ (\ ! map (|>> (//.nth 0) maybe.assume)))]
- (in (` (<t>.range (~ (code.nat from)) (~ (code.nat to)))))))
+ (in (` (<text>.range (~ (code.nat from)) (~ (code.nat to)))))))
(def: re_char^
(Parser Code)
@@ -100,18 +101,18 @@
(def: re_options^
(Parser Code)
(do <>.monad
- [options (<t>.many escaped_char^)]
- (in (` (<t>.one_of (~ (code.text options)))))))
+ [options (<text>.many escaped_char^)]
+ (in (` (<text>.one_of (~ (code.text options)))))))
(def: re_user_class^'
(Parser Code)
(do <>.monad
- [negate? (<>.maybe (<t>.this "^"))
+ [negate? (<>.maybe (<text>.this "^"))
parts (<>.many ($_ <>.either
re_range^
re_options^))]
(in (case negate?
- (#.Some _) (` (<t>.not ($_ <>.either (~+ parts))))
+ (#.Some _) (` (<text>.not ($_ <>.either (~+ parts))))
#.None (` ($_ <>.either (~+ parts)))))))
(def: re_user_class^
@@ -119,7 +120,7 @@
(do <>.monad
[_ (in [])
init re_user_class^'
- rest (<>.some (<>.after (<t>.this "&&") (<t>.enclosed ["[" "]"] re_user_class^')))]
+ rest (<>.some (<>.after (<text>.this "&&") (<text>.enclosed ["[" "]"] re_user_class^')))]
(in (list\fold (function (_ refinement base)
(` ((~! refine^) (~ refinement) (~ base))))
init
@@ -127,80 +128,80 @@
(def: blank^
(Parser Text)
- (<t>.one_of (format " " //.tab)))
+ (<text>.one_of (format " " //.tab)))
(def: ascii^
(Parser Text)
- (<t>.range (hex "0") (hex "7F")))
+ (<text>.range (hex "0") (hex "7F")))
(def: control^
(Parser Text)
- (<>.either (<t>.range (hex "0") (hex "1F"))
- (<t>.one_of (//.of_code (hex "7F")))))
+ (<>.either (<text>.range (hex "0") (hex "1F"))
+ (<text>.one_of (//.of_code (hex "7F")))))
(def: punct^
(Parser Text)
- (<t>.one_of (format "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
- //.double_quote)))
+ (<text>.one_of (format "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
+ //.double_quote)))
(def: graph^
(Parser Text)
- (<>.either punct^ <t>.alpha_num))
+ (<>.either punct^ <text>.alpha_num))
(def: print^
(Parser Text)
(<>.either graph^
- (<t>.one_of (//.of_code (hex "20")))))
+ (<text>.one_of (//.of_code (hex "20")))))
(def: re_system_class^
(Parser Code)
(do <>.monad
[]
($_ <>.either
- (<>.after (<t>.this ".") (in (` <t>.any)))
- (<>.after (<t>.this "\d") (in (` <t>.decimal)))
- (<>.after (<t>.this "\D") (in (` (<t>.not <t>.decimal))))
- (<>.after (<t>.this "\s") (in (` <t>.space)))
- (<>.after (<t>.this "\S") (in (` (<t>.not <t>.space))))
- (<>.after (<t>.this "\w") (in (` (~! word^))))
- (<>.after (<t>.this "\W") (in (` (<t>.not (~! word^)))))
-
- (<>.after (<t>.this "\p{Lower}") (in (` <t>.lower)))
- (<>.after (<t>.this "\p{Upper}") (in (` <t>.upper)))
- (<>.after (<t>.this "\p{Alpha}") (in (` <t>.alpha)))
- (<>.after (<t>.this "\p{Digit}") (in (` <t>.decimal)))
- (<>.after (<t>.this "\p{Alnum}") (in (` <t>.alpha_num)))
- (<>.after (<t>.this "\p{Space}") (in (` <t>.space)))
- (<>.after (<t>.this "\p{HexDigit}") (in (` <t>.hexadecimal)))
- (<>.after (<t>.this "\p{OctDigit}") (in (` <t>.octal)))
- (<>.after (<t>.this "\p{Blank}") (in (` (~! blank^))))
- (<>.after (<t>.this "\p{ASCII}") (in (` (~! ascii^))))
- (<>.after (<t>.this "\p{Contrl}") (in (` (~! control^))))
- (<>.after (<t>.this "\p{Punct}") (in (` (~! punct^))))
- (<>.after (<t>.this "\p{Graph}") (in (` (~! graph^))))
- (<>.after (<t>.this "\p{Print}") (in (` (~! print^))))
+ (<>.after (<text>.this ".") (in (` <text>.any)))
+ (<>.after (<text>.this "\d") (in (` <text>.decimal)))
+ (<>.after (<text>.this "\D") (in (` (<text>.not <text>.decimal))))
+ (<>.after (<text>.this "\s") (in (` <text>.space)))
+ (<>.after (<text>.this "\S") (in (` (<text>.not <text>.space))))
+ (<>.after (<text>.this "\w") (in (` (~! word^))))
+ (<>.after (<text>.this "\W") (in (` (<text>.not (~! word^)))))
+
+ (<>.after (<text>.this "\p{Lower}") (in (` <text>.lower)))
+ (<>.after (<text>.this "\p{Upper}") (in (` <text>.upper)))
+ (<>.after (<text>.this "\p{Alpha}") (in (` <text>.alpha)))
+ (<>.after (<text>.this "\p{Digit}") (in (` <text>.decimal)))
+ (<>.after (<text>.this "\p{Alnum}") (in (` <text>.alpha_num)))
+ (<>.after (<text>.this "\p{Space}") (in (` <text>.space)))
+ (<>.after (<text>.this "\p{HexDigit}") (in (` <text>.hexadecimal)))
+ (<>.after (<text>.this "\p{OctDigit}") (in (` <text>.octal)))
+ (<>.after (<text>.this "\p{Blank}") (in (` (~! blank^))))
+ (<>.after (<text>.this "\p{ASCII}") (in (` (~! ascii^))))
+ (<>.after (<text>.this "\p{Contrl}") (in (` (~! control^))))
+ (<>.after (<text>.this "\p{Punct}") (in (` (~! punct^))))
+ (<>.after (<text>.this "\p{Graph}") (in (` (~! graph^))))
+ (<>.after (<text>.this "\p{Print}") (in (` (~! print^))))
)))
(def: re_class^
(Parser Code)
(<>.either re_system_class^
- (<t>.enclosed ["[" "]"] re_user_class^)))
+ (<text>.enclosed ["[" "]"] re_user_class^)))
(def: number^
(Parser Nat)
- (|> (<t>.many <t>.decimal)
+ (|> (<text>.many <text>.decimal)
(<>.codec n.decimal)))
(def: re_back_reference^
(Parser Code)
(<>.either (do <>.monad
- [_ (<t>.this "\")
+ [_ (<text>.this "\")
id number^]
(in (` ((~! ..copy) (~ (code.identifier ["" (n\encode id)]))))))
(do <>.monad
- [_ (<t>.this "\k<")
+ [_ (<text>.this "\k<")
captured_name name_part^
- _ (<t>.this ">")]
+ _ (<text>.this ">")]
(in (` ((~! ..copy) (~ (code.identifier ["" captured_name]))))))))
(def: (re_simple^ current_module)
@@ -216,7 +217,7 @@
(-> Text (Parser Code))
(do <>.monad
[base (re_simple^ current_module)
- quantifier (<t>.one_of "?*+")]
+ quantifier (<text>.one_of "?*+")]
(case quantifier
"?"
(in (` (<>.default "" (~ base))))
@@ -229,26 +230,33 @@
(in (` ((~! join_text^) (<>.many (~ base)))))
)))
+(exception: #export (incorrect_quantification {from Nat} {to Nat})
+ (exception.report
+ ["Input" (format (%.nat from) "," (%.nat to))]
+ ["Should be" (format (%.nat to) "," (%.nat from))]))
+
(def: (re_counted_quantified^ current_module)
(-> Text (Parser Code))
(do {! <>.monad}
[base (re_simple^ current_module)]
- (<t>.enclosed ["{" "}"]
- ($_ <>.either
- (do !
- [[from to] (<>.and number^ (<>.after (<t>.this ",") number^))]
- (in (` ((~! join_text^) (<>.between (~ (code.nat from))
- (~ (code.nat to))
- (~ base))))))
- (do !
- [limit (<>.after (<t>.this ",") number^)]
- (in (` ((~! join_text^) (<>.at_most (~ (code.nat limit)) (~ base))))))
- (do !
- [limit (<>.before (<t>.this ",") number^)]
- (in (` ((~! join_text^) (<>.at_least (~ (code.nat limit)) (~ base))))))
- (do !
- [limit number^]
- (in (` ((~! join_text^) (<>.exactly (~ (code.nat limit)) (~ base))))))))))
+ (<| (<text>.enclosed ["{" "}"])
+ ($_ <>.either
+ (do !
+ [[from to] (<>.and number^ (<>.after (<text>.this ",") number^))
+ _ (<>.assert (exception.construct ..incorrect_quantification [from to])
+ (n.<= to from))]
+ (in (` ((~! join_text^) (<>.between (~ (code.nat from))
+ (~ (code.nat (n.- from to)))
+ (~ base))))))
+ (do !
+ [limit (<>.after (<text>.this ",") number^)]
+ (in (` ((~! join_text^) (<>.at_most (~ (code.nat limit)) (~ base))))))
+ (do !
+ [limit (<>.before (<text>.this ",") number^)]
+ (in (` ((~! join_text^) (<>.at_least (~ (code.nat limit)) (~ base))))))
+ (do !
+ [limit number^]
+ (in (` ((~! join_text^) (<>.exactly (~ (code.nat limit)) (~ base))))))))))
(def: (re_quantified^ current_module)
(-> Text (Parser Code))
@@ -364,7 +372,7 @@
(do <>.monad
[#let [sub^ (re_sequential^ capturing? re_scoped^ current_module)]
head sub^
- tail (<>.some (<>.after (<t>.this "|") sub^))]
+ 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))
@@ -378,31 +386,31 @@
(-> Text (Parser [Re_Group Code]))
($_ <>.either
(do <>.monad
- [_ (<t>.this "(?:")
+ [_ (<text>.this "(?:")
[_ scoped] (re_alternative^ #0 re_scoped^ current_module)
- _ (<t>.this ")")]
+ _ (<text>.this ")")]
(in [#Non_Capturing scoped]))
(do <>.monad
[complex (re_complex^ current_module)]
(in [#Non_Capturing complex]))
(do <>.monad
- [_ (<t>.this "(?<")
+ [_ (<text>.this "(?<")
captured_name name_part^
- _ (<t>.this ">")
+ _ (<text>.this ">")
[num_captures pattern] (re_alternative^ #1 re_scoped^ current_module)
- _ (<t>.this ")")]
+ _ (<text>.this ")")]
(in [(#Capturing [(#.Some captured_name) num_captures]) pattern]))
(do <>.monad
- [_ (<t>.this "(")
+ [_ (<text>.this "(")
[num_captures pattern] (re_alternative^ #1 re_scoped^ current_module)
- _ (<t>.this ")")]
+ _ (<text>.this ")")]
(in [(#Capturing [#.None num_captures]) pattern]))))
(def: (regex^ current_module)
(-> Text (Parser Code))
(\ <>.monad map product.right (re_alternative^ #1 re_scoped^ current_module)))
-(syntax: #export (regex {pattern <c>.text})
+(syntax: #export (regex {pattern <code>.text})
{#.doc (doc "Create lexers using regular-expression syntax."
"For example:"
@@ -463,8 +471,8 @@
)}
(do meta.monad
[current_module meta.current_module_name]
- (case (<t>.run (regex^ current_module)
- pattern)
+ (case (<text>.run (regex^ current_module)
+ pattern)
(#try.Failure error)
(meta.failure (format "Error while parsing regular-expression:" //.new_line
error))
@@ -473,9 +481,9 @@
(in (list regex))
)))
-(syntax: #export (^regex {[pattern bindings] (<c>.form (<>.and <c>.text (<>.maybe <c>.any)))}
+(syntax: #export (^regex {[pattern bindings] (<code>.form (<>.and <code>.text (<>.maybe <code>.any)))}
body
- {branches (<>.many <c>.any)})
+ {branches (<>.many <code>.any)})
{#.doc (doc "Allows you to test text against regular expressions."
(case some_text
(^regex "(\d{3})-(\d{3})-(\d{4})"
@@ -489,7 +497,7 @@
do_something_else))}
(with_gensyms [g!temp]
(in (list& (` (^multi (~ g!temp)
- {((~! <t>.run) (..regex (~ (code.text pattern))) (~ g!temp))
+ {((~! <text>.run) (..regex (~ (code.text pattern))) (~ g!temp))
(#try.Success (~ (maybe.default g!temp bindings)))}))
body
branches))))
diff --git a/stdlib/source/library/lux/debug.lux b/stdlib/source/library/lux/debug.lux
index 2778746ea..2e6b46b4f 100644
--- a/stdlib/source/library/lux/debug.lux
+++ b/stdlib/source/library/lux/debug.lux
@@ -138,7 +138,7 @@
array.to_list
(list\map inspection)
(text.join_with " ")
- (text.enclose ["[" "]"])))))
+ (text.enclosed ["[" "]"])))))
(def: #export (inspection value)
Inspector
@@ -171,7 +171,7 @@
(|> (%.format (%.nat (.nat (java/lang/Integer::longValue tag)))
" " (%.bit last?)
" " (inspection choice))
- (text.enclose ["(" ")"])))
+ (text.enclosed ["(" ")"])))
_
(tuple_inspection inspection value)))
@@ -200,7 +200,7 @@
(|> (%.format (JSON::stringify variant_tag)
" " (%.bit (not ("js object null?" variant_flag)))
" " (inspection variant_value))
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(not (or ("js object undefined?" ("js object get" "_lux_low" value))
("js object undefined?" ("js object get" "_lux_high" value))))
@@ -241,7 +241,7 @@
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (|> variant_flag "python object none?" not %.bit)
" " (inspection variant_value))
- (text.enclose ["(" ")"]))))
+ (text.enclosed ["(" ")"]))))
_ (..str value)))
_
@@ -274,7 +274,7 @@
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (%.bit (not ("lua object nil?" variant_flag)))
" " (inspection variant_value))
- (text.enclose ["(" ")"]))))
+ (text.enclosed ["(" ")"]))))
_
(..tostring value))
@@ -312,7 +312,7 @@
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (%.bit (not ("ruby object nil?" variant_flag)))
" " (inspection variant_value))
- (text.enclose ["(" ")"]))))
+ (text.enclosed ["(" ")"]))))
(is? (class_of [[] []]) value_class)
(tuple_inspection inspection value)
@@ -342,7 +342,7 @@
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (%.bit (not ("php object null?" variant_flag)))
" " (inspection variant_value))
- (text.enclose ["(" ")"]))))
+ (text.enclosed ["(" ")"]))))
_
(..strval value))
@@ -370,7 +370,7 @@
(|> (%.format (|> variant_tag (:as .Nat) %.nat)
" " (%.bit (not ("scheme object nil?" variant_flag)))
" " (inspection variant_value))
- (text.enclose ["(" ")"])))
+ (text.enclosed ["(" ")"])))
(..format ["~s" value])))
## else
diff --git a/stdlib/source/library/lux/ffi.old.lux b/stdlib/source/library/lux/ffi.old.lux
index 5187df976..16ff216e4 100644
--- a/stdlib/source/library/lux/ffi.old.lux
+++ b/stdlib/source/library/lux/ffi.old.lux
@@ -227,7 +227,7 @@
(#FieldAccessDecl ImportFieldDecl))
## Utils
-(def: (manual_primitive_to_type class)
+(def: (manual_primitive_type class)
(-> Text (Maybe Code))
(case class
(^template [<prim> <type>]
@@ -246,7 +246,7 @@
_
#.None))
-(def: (auto_primitive_to_type class)
+(def: (auto_primitive_type class)
(-> Text (Maybe Code))
(case class
(^template [<prim> <type>]
@@ -268,26 +268,26 @@
(-> Text Text)
(text.replace_all "/" "."))
-(def: (generic_class_to_type' mode type_params in_array? name+params
- class_to_type')
+(def: (generic_class_type' mode type_params in_array? name+params
+ class_type')
(-> Primitive_Mode (List Type_Parameter) Bit [Text (List GenericType)]
(-> Primitive_Mode (List Type_Parameter) Bit GenericType Code)
Code)
(case [name+params mode in_array?]
(^multi [[prim #.End] #ManualPrM #0]
- {(manual_primitive_to_type prim) (#.Some output)})
+ {(manual_primitive_type prim) (#.Some output)})
output
(^multi [[prim #.End] #AutoPrM #0]
- {(auto_primitive_to_type prim) (#.Some output)})
+ {(auto_primitive_type prim) (#.Some output)})
output
[[name params] _ _]
(let [name (safe name)
- =params (list\map (class_to_type' mode type_params in_array?) params)]
+ =params (list\map (class_type' mode type_params in_array?) params)]
(` (primitive (~ (code.text name)) [(~+ =params)])))))
-(def: (class_to_type' mode type_params in_array? class)
+(def: (class_type' mode type_params in_array? class)
(-> Primitive_Mode (List Type_Parameter) Bit GenericType Code)
(case class
(#GenericTypeVar name)
@@ -299,26 +299,26 @@
(code.identifier ["" name])
(#.Some [pname pbounds])
- (class_to_type' mode type_params in_array? (maybe.assume (list.head pbounds))))
+ (class_type' mode type_params in_array? (maybe.assume (list.head pbounds))))
(#GenericClass name+params)
- (generic_class_to_type' mode type_params in_array? name+params
- class_to_type')
+ (generic_class_type' mode type_params in_array? name+params
+ class_type')
(#GenericArray param)
- (let [=param (class_to_type' mode type_params #1 param)]
+ (let [=param (class_type' mode type_params #1 param)]
(` ((~! array.Array) (~ =param))))
(^or (#GenericWildcard #.None) (#GenericWildcard (#.Some [#LowerBound _])))
(` .Any)
(#GenericWildcard (#.Some [#UpperBound upper_bound]))
- (class_to_type' mode type_params in_array? upper_bound)
+ (class_type' mode type_params in_array? upper_bound)
))
-(def: (class_to_type mode type_params class)
+(def: (class_type mode type_params class)
(-> Primitive_Mode (List Type_Parameter) GenericType Code)
- (class_to_type' mode type_params #0 class))
+ (class_type' mode type_params #0 class))
(def: (type_param_type$ [name bounds])
(-> Type_Parameter Code)
@@ -333,7 +333,7 @@
(code.identifier ["" pname])
(#.Item bound1 _)
- (class_to_type #ManualPrM class_params bound1))))
+ (class_type #ManualPrM class_params bound1))))
class_params)]
(` (primitive (~ (code.text (safe class_name)))
[(~+ =params)]))))
@@ -384,21 +384,21 @@
(format "[L" (simple_class$ env param) ";"))
))
-(def: (make_get_const_parser class_name field_name)
+(def: (get_const_parser class_name field_name)
(-> Text Text (Parser Code))
(do <>.monad
[#let [dotted_name (format "::" field_name)]
_ (<code>.this! (code.identifier ["" dotted_name]))]
(in (`' ((~ (code.text (format "jvm getstatic" ":" class_name ":" field_name))))))))
-(def: (make_get_var_parser class_name field_name)
+(def: (get_var_parser class_name field_name)
(-> Text Text (Parser Code))
(do <>.monad
[#let [dotted_name (format "::" field_name)]
_ (<code>.this! (code.identifier ["" dotted_name]))]
(in (`' ((~ (code.text (format "jvm getfield" ":" class_name ":" field_name))) _jvm_this)))))
-(def: (make_put_var_parser class_name field_name)
+(def: (put_var_parser class_name field_name)
(-> Text Text (Parser Code))
(do <>.monad
[#let [dotted_name (format "::" field_name)]
@@ -424,7 +424,7 @@
ast'
ast'))
-(def: (parser_to_replacer p ast)
+(def: (parser_replacer p ast)
(-> (Parser Code) (-> Code Code))
(case (<>.run p (list ast))
(#.Right [#.End ast'])
@@ -434,17 +434,17 @@
ast
))
-(def: (field_to_parser class_name [[field_name _ _] field])
+(def: (field_parser class_name [[field_name _ _] field])
(-> Text [Member_Declaration FieldDecl] (Parser Code))
(case field
(#ConstantField _)
- (make_get_const_parser class_name field_name)
+ (get_const_parser class_name field_name)
(#VariableField _)
- (<>.either (make_get_var_parser class_name field_name)
- (make_put_var_parser class_name field_name))))
+ (<>.either (get_var_parser class_name field_name)
+ (put_var_parser class_name field_name))))
-(def: (make_constructor_parser params class_name arg_decls)
+(def: (constructor_parser params class_name arg_decls)
(-> (List Type_Parameter) Text (List ArgDecl) (Parser Code))
(do <>.monad
[args (: (Parser (List Code))
@@ -454,7 +454,7 @@
(in (` ((~ (code.text (format "jvm new" ":" class_name ":" (text.join_with "," arg_decls'))))
(~+ args))))))
-(def: (make_static_method_parser params class_name method_name arg_decls)
+(def: (static_method_parser params class_name method_name arg_decls)
(-> (List Type_Parameter) Text Text (List ArgDecl) (Parser Code))
(do <>.monad
[#let [dotted_name (format "::" method_name "!")]
@@ -477,28 +477,28 @@
(in (`' ((~ (code.text (format <jvm_op> ":" class_name ":" method_name ":" (text.join_with "," arg_decls'))))
(~' _jvm_this) (~+ args))))))]
- [make_special_method_parser "jvm invokespecial"]
- [make_virtual_method_parser "jvm invokevirtual"]
+ [special_method_parser "jvm invokespecial"]
+ [virtual_method_parser "jvm invokevirtual"]
)
-(def: (method_to_parser params class_name [[method_name _ _] meth_def])
+(def: (method_parser params class_name [[method_name _ _] meth_def])
(-> (List Type_Parameter) Text [Member_Declaration Method_Definition] (Parser Code))
(case meth_def
(#ConstructorMethod strict? type_vars args constructor_args return_expr exs)
- (make_constructor_parser params class_name args)
+ (constructor_parser params class_name args)
(#StaticMethod strict? type_vars args return_type return_expr exs)
- (make_static_method_parser params class_name method_name args)
+ (static_method_parser params class_name method_name args)
(^or (#VirtualMethod final? strict? type_vars self_name args return_type return_expr exs)
(#OverridenMethod strict? owner_class type_vars self_name args return_type return_expr exs))
- (make_special_method_parser params class_name method_name args)
+ (special_method_parser params class_name method_name args)
(#AbstractMethod type_vars args return_type exs)
- (make_virtual_method_parser params class_name method_name args)
+ (virtual_method_parser params class_name method_name args)
(#NativeMethod type_vars args return_type exs)
- (make_virtual_method_parser params class_name method_name args)))
+ (virtual_method_parser params class_name method_name args)))
## Parsers
(def: privacy_modifier^
@@ -941,11 +941,11 @@
## Generators
(def: with_parens
(-> JVM_Code JVM_Code)
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(def: with_brackets
(-> JVM_Code JVM_Code)
- (text.enclose ["[" "]"]))
+ (text.enclosed ["[" "]"]))
(def: spaced
(-> (List JVM_Code) JVM_Code)
@@ -1092,16 +1092,16 @@
(~ body))))))))
(#OverridenMethod strict_fp? class_decl type_vars this_name arg_decls return_type body exs)
- (let [super_replacer (parser_to_replacer (<code>.form (do <>.monad
- [_ (<code>.this! (' ::super!))
- args (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))
- #let [arg_decls' (: (List Text) (list\map (|>> product.right (simple_class$ (list)))
- arg_decls))]]
- (in (`' ((~ (code.text (format "jvm invokespecial"
- ":" (get@ #super_class_name super_class)
- ":" name
- ":" (text.join_with "," arg_decls'))))
- (~' _jvm_this) (~+ args)))))))]
+ (let [super_replacer (parser_replacer (<code>.form (do <>.monad
+ [_ (<code>.this! (' ::super!))
+ args (<code>.tuple (<>.exactly (list.size arg_decls) <code>.any))
+ #let [arg_decls' (: (List Text) (list\map (|>> product.right (simple_class$ (list)))
+ arg_decls))]]
+ (in (`' ((~ (code.text (format "jvm invokespecial"
+ ":" (get@ #super_class_name super_class)
+ ":" name
+ ":" (text.join_with "," arg_decls'))))
+ (~' _jvm_this) (~+ args)))))))]
(with_parens
(spaced (list "override"
(class_decl$ class_decl)
@@ -1210,11 +1210,11 @@
(do meta.monad
[current_module meta.current_module_name
#let [fully_qualified_class_name (format (safe current_module) "." full_class_name)
- field_parsers (list\map (field_to_parser fully_qualified_class_name) fields)
- method_parsers (list\map (method_to_parser (product.right class_decl) fully_qualified_class_name) methods)
- replacer (parser_to_replacer (list\fold <>.either
- (<>.failure "")
- (list\compose field_parsers method_parsers)))
+ 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)))
def_code (format "jvm class:"
(spaced (list (class_decl$ class_decl)
(super_class_decl$ super)
@@ -1399,7 +1399,7 @@
import_member_args))
arg_types (list\map (: (-> [Bit GenericType] Code)
(function (_ [maybe? arg])
- (let [arg_type (class_to_type (get@ #import_member_mode commons) type_params arg)]
+ (let [arg_type (class_type (get@ #import_member_mode commons) type_params arg)]
(if maybe?
(` (Maybe (~ arg_type)))
arg_type))))
@@ -1568,7 +1568,7 @@
(#FieldAccessDecl fad)
(do meta.monad
[#let [(^open ".") fad
- base_gtype (class_to_type import_field_mode type_params import_field_type)
+ base_gtype (class_type import_field_mode type_params import_field_type)
classC (class_decl_type$ class)
typeC (if import_field_maybe?
(` (Maybe (~ base_gtype)))
@@ -1740,7 +1740,7 @@
(array_length my_array))}
(in (list (` ("jvm arraylength" (~ array))))))
-(def: (type_to_class_name type)
+(def: (type_class_name type)
(-> Type (Meta Text))
(if (type\= Any type)
(\ meta.monad in "java.lang.Object")
@@ -1754,10 +1754,10 @@
(meta.failure (format "Cannot apply type: " (type.format F) " to " (type.format A)))
(#.Some type')
- (type_to_class_name type'))
+ (type_class_name type'))
(#.Named _ type')
- (type_to_class_name type')
+ (type_class_name type')
_
(meta.failure (format "Cannot convert to JvmType: " (type.format type))))))
@@ -1769,7 +1769,7 @@
[_ (#.Identifier array_name)]
(do meta.monad
[array_type (meta.type array_name)
- array_jvm_type (type_to_class_name array_type)]
+ array_jvm_type (type_class_name array_type)]
(case array_jvm_type
(^template [<type> <array_op>]
[<type>
@@ -1798,7 +1798,7 @@
[_ (#.Identifier array_name)]
(do meta.monad
[array_type (meta.type array_name)
- array_jvm_type (type_to_class_name array_type)]
+ array_jvm_type (type_class_name array_type)]
(case array_jvm_type
(^template [<type> <array_op>]
[<type>
@@ -1826,4 +1826,4 @@
(in (list (` ("jvm object class" (~ (code.text (simple_class$ (list) type))))))))
(syntax: #export (type {type (..generic_type^ (list))})
- (in (list (..class_to_type #ManualPrM (list) type))))
+ (in (list (..class_type #ManualPrM (list) type))))
diff --git a/stdlib/source/library/lux/macro.lux b/stdlib/source/library/lux/macro.lux
index e80b1d665..11509f0cc 100644
--- a/stdlib/source/library/lux/macro.lux
+++ b/stdlib/source/library/lux/macro.lux
@@ -18,7 +18,7 @@
["#" meta
["." location]]])
-(def: #export (expand_once syntax)
+(def: #export (single_expansion syntax)
{#.doc (doc "Given code that requires applying a macro, does it once and returns the result."
"Otherwise, returns the code as-is.")}
(-> Code (Meta (List Code)))
@@ -36,7 +36,7 @@
_
(\ //.monad in (list syntax))))
-(def: #export (expand syntax)
+(def: #export (expansion syntax)
{#.doc (doc "Given code that requires applying a macro, expands repeatedly until no more direct macro-calls are left."
"Otherwise, returns the code as-is.")}
(-> Code (Meta (List Code)))
@@ -46,10 +46,11 @@
[?macro (//.macro name)]
(case ?macro
(#.Some macro)
- (do //.monad
- [expansion ((:as Macro' macro) args)
- expansion' (monad.map //.monad expand expansion)]
- (in (list\join expansion')))
+ (do {! //.monad}
+ [top_level_expansion ((:as Macro' macro) args)]
+ (|> top_level_expansion
+ (monad.map //.monad expansion)
+ (\ ! map list\join)))
#.None
(\ //.monad in (list syntax))))
@@ -57,7 +58,7 @@
_
(\ //.monad in (list syntax))))
-(def: #export (expand_all syntax)
+(def: #export (full_expansion syntax)
{#.doc "Expands all macro-calls everywhere recursively, until only primitive/base code remains."}
(-> Code (Meta (List Code)))
(case syntax
@@ -68,23 +69,23 @@
(#.Some macro)
(do //.monad
[expansion ((:as Macro' macro) args)
- expansion' (monad.map //.monad expand_all expansion)]
+ expansion' (monad.map //.monad full_expansion expansion)]
(in (list\join expansion')))
#.None
(do //.monad
- [parts' (monad.map //.monad expand_all (list& (code.identifier name) args))]
+ [parts' (monad.map //.monad full_expansion (list& (code.identifier name) args))]
(in (list (code.form (list\join parts')))))))
[_ (#.Form (#.Item [harg targs]))]
(do //.monad
- [harg+ (expand_all harg)
- targs+ (monad.map //.monad expand_all targs)]
+ [harg+ (full_expansion harg)
+ targs+ (monad.map //.monad full_expansion targs)]
(in (list (code.form (list\compose harg+ (list\join (: (List (List Code)) targs+)))))))
[_ (#.Tuple members)]
(do //.monad
- [members' (monad.map //.monad expand_all members)]
+ [members' (monad.map //.monad full_expansion members)]
(in (list (code.tuple (list\join members')))))
[_ (#.Record members)]
@@ -92,8 +93,8 @@
(monad.map //.monad
(function (_ [left right])
(do //.monad
- [left (expand_all left)
- right (expand_all right)]
+ [left (full_expansion left)
+ right (full_expansion right)]
(case [left right]
[(#.Item left #.End) (#.Item right #.End)]
(in [left right])
@@ -154,11 +155,11 @@
_
(//.failure (..wrong_syntax_error (name_of ..with_gensyms)))))
-(def: #export (expand_1 token)
+(def: #export (one_expansion token)
{#.doc "Works just like expand, except that it ensures that the output is a single Code token."}
(-> Code (Meta Code))
(do //.monad
- [token+ (..expand token)]
+ [token+ (..expansion token)]
(case token+
(^ (list token'))
(in token')
@@ -204,7 +205,7 @@
#.None
(//.failure (..wrong_syntax_error macro_name)))))]
- [log_expand_once! ..expand_once]
- [log_expand! ..expand]
- [log_expand_all! ..expand_all]
+ [log_single_expansion! ..single_expansion]
+ [log_expansion! ..expansion]
+ [log_full_expansion! ..full_expansion]
)
diff --git a/stdlib/source/library/lux/macro/syntax/definition.lux b/stdlib/source/library/lux/macro/syntax/definition.lux
index 3b8bab1d5..da2adcd82 100644
--- a/stdlib/source/library/lux/macro/syntax/definition.lux
+++ b/stdlib/source/library/lux/macro/syntax/definition.lux
@@ -105,7 +105,7 @@
(do {! <>.monad}
[raw <code>.any
me_raw (|> raw
- macro.expand_all
+ macro.full_expansion
(meta.run compiler)
<>.lift)]
(<| (<code>.local me_raw)
diff --git a/stdlib/source/library/lux/math/number/i16.lux b/stdlib/source/library/lux/math/number/i16.lux
index a35300c11..1fd3e6b02 100644
--- a/stdlib/source/library/lux/math/number/i16.lux
+++ b/stdlib/source/library/lux/math/number/i16.lux
@@ -9,7 +9,8 @@
[//
["." i64 (#+ Sub)]])
-(def: sub (maybe.assume (i64.sub 16)))
+(def: sub
+ (maybe.assume (i64.sub 16)))
(def: #export I16
(:by_example [size]
diff --git a/stdlib/source/library/lux/math/number/i8.lux b/stdlib/source/library/lux/math/number/i8.lux
index 2e8fc0cf1..16da5b679 100644
--- a/stdlib/source/library/lux/math/number/i8.lux
+++ b/stdlib/source/library/lux/math/number/i8.lux
@@ -9,7 +9,8 @@
[//
["." i64 (#+ Sub)]])
-(def: sub (maybe.assume (i64.sub 8)))
+(def: sub
+ (maybe.assume (i64.sub 8)))
(def: #export I8
(:by_example [size]
diff --git a/stdlib/source/library/lux/meta.lux b/stdlib/source/library/lux/meta.lux
index 3a6174cda..728e969b8 100644
--- a/stdlib/source/library/lux/meta.lux
+++ b/stdlib/source/library/lux/meta.lux
@@ -383,11 +383,11 @@
(type_definition de_aliased)
(#.Right [exported? def_type def_data def_value])
- (let [type_to_code (`` ("lux in-module" (~~ (static .prelude_module)) .type_to_code))]
+ (let [type_code (`` ("lux in-module" (~~ (static .prelude_module)) .type_code))]
(if (or (is? .Type def_type)
(\ code.equivalence =
- (type_to_code .Type)
- (type_to_code def_type)))
+ (type_code .Type)
+ (type_code def_type)))
(in (:as Type def_value))
(..failure ($_ text\compose "Definition is not a type: " (name\encode name))))))))
diff --git a/stdlib/source/library/lux/target/common_lisp.lux b/stdlib/source/library/lux/target/common_lisp.lux
index ecc778d98..ed040a6b4 100644
--- a/stdlib/source/library/lux/target/common_lisp.lux
+++ b/stdlib/source/library/lux/target/common_lisp.lux
@@ -18,7 +18,7 @@
(def: as_form
(-> Text Text)
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(abstract: #export (Code brand)
Text
@@ -135,7 +135,7 @@
(def: #export string
(-> Text Literal)
(|>> ..safe
- (text.enclose' text.double_quote)
+ (text.enclosed' text.double_quote)
:abstraction))
(def: #export var
diff --git a/stdlib/source/library/lux/target/js.lux b/stdlib/source/library/lux/target/js.lux
index d19bb0b8b..8bbb1dd93 100644
--- a/stdlib/source/library/lux/target/js.lux
+++ b/stdlib/source/library/lux/target/js.lux
@@ -17,8 +17,11 @@
[type
abstract]]])
-(def: expression (text.enclose ["(" ")"]))
-(def: element (text.enclose ["[" "]"]))
+(def: expression
+ (text.enclosed ["(" ")"]))
+
+(def: element
+ (text.enclosed ["[" "]"]))
(def: nest
(-> Text Text)
@@ -105,7 +108,7 @@
(def: #export string
(-> Text Literal)
(|>> ..safe
- (text.enclose [text.double_quote text.double_quote])
+ (text.enclosed [text.double_quote text.double_quote])
:abstraction))
(def: argument_separator ", ")
@@ -149,7 +152,7 @@
(|>> (list\map (.function (_ [key val])
(format (:representation (..string key)) ..field_separator (:representation val))))
(text.join_with ..argument_separator)
- (text.enclose ["{" "}"])
+ (text.enclosed ["{" "}"])
..expression
:abstraction))
@@ -170,8 +173,8 @@
(let [close (format text.new_line "}")]
(|>> :representation
..nest
- (text.enclose ["{"
- close]))))
+ (text.enclosed ["{"
+ close]))))
(def: #export (function! name inputs body)
(-> Var (List Var) Statement Statement)
@@ -405,7 +408,7 @@
(|> (format (|> cases
(list\map (.function (_ [when then])
(format (|> when
- (list\map (|>> :representation (text.enclose ["case " ":"])))
+ (list\map (|>> :representation (text.enclosed ["case " ":"])))
(text.join_with text.new_line))
(..nest (:representation then)))))
(text.join_with text.new_line))
diff --git a/stdlib/source/library/lux/target/jvm/type/descriptor.lux b/stdlib/source/library/lux/target/jvm/type/descriptor.lux
index 2cdbeb6ee..6f36f544b 100644
--- a/stdlib/source/library/lux/target/jvm/type/descriptor.lux
+++ b/stdlib/source/library/lux/target/jvm/type/descriptor.lux
@@ -50,7 +50,7 @@
(-> External (Descriptor Class))
(|>> ///name.internal
///name.read
- (text.enclose [..class_prefix ..class_suffix])
+ (text.enclosed [..class_prefix ..class_suffix])
:abstraction))
(def: #export (declaration name)
@@ -96,7 +96,7 @@
(format (|> inputs
(list\map ..descriptor)
(text.join_with "")
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(:representation output))))
(implementation: #export equivalence
diff --git a/stdlib/source/library/lux/target/jvm/type/signature.lux b/stdlib/source/library/lux/target/jvm/type/signature.lux
index 7e1164671..84a6a5982 100644
--- a/stdlib/source/library/lux/target/jvm/type/signature.lux
+++ b/stdlib/source/library/lux/target/jvm/type/signature.lux
@@ -55,7 +55,7 @@
(def: #export var
(-> Text (Signature Var))
- (|>> (text.enclose [..var_prefix //descriptor.class_suffix])
+ (|>> (text.enclosed [..var_prefix //descriptor.class_suffix])
:abstraction))
(def: #export var_name
@@ -129,13 +129,13 @@
(list\map (|>> ..var_name
(text.suffix ..class_bound)))
(text.join_with "")
- (text.enclose [..parameters_start
- ..parameters_end])))
+ (text.enclosed [..parameters_start
+ ..parameters_end])))
(|> inputs
(list\map ..signature)
(text.join_with "")
- (text.enclose [..arguments_start
- ..arguments_end]))
+ (text.enclosed [..arguments_start
+ ..arguments_end]))
(:representation output)
(|> exceptions
(list\map (|>> :representation (format ..exception_prefix)))
diff --git a/stdlib/source/library/lux/target/lua.lux b/stdlib/source/library/lux/target/lua.lux
index 74a975754..05a2847e7 100644
--- a/stdlib/source/library/lux/target/lua.lux
+++ b/stdlib/source/library/lux/target/lua.lux
@@ -134,7 +134,7 @@
(def: #export string
(-> Text Literal)
- (|>> ..safe (text.enclose' text.double_quote) :abstraction))
+ (|>> ..safe (text.enclosed' text.double_quote) :abstraction))
(def: #export multi
(-> (List Expression) Literal)
@@ -146,7 +146,7 @@
(-> (List Expression) Literal)
(|>> (list\map ..code)
(text.join_with ..input_separator)
- (text.enclose ["{" "}"])
+ (text.enclosed ["{" "}"])
:abstraction))
(def: #export table
@@ -154,7 +154,7 @@
(|>> (list\map (.function (_ [key value])
(format key " = " (:representation value))))
(text.join_with ..input_separator)
- (text.enclose ["{" "}"])
+ (text.enclosed ["{" "}"])
:abstraction))
(def: #export (nth idx array)
@@ -168,7 +168,7 @@
(def: #export length
(-> Expression Computation)
(|>> :representation
- (text.enclose ["#(" ")"])
+ (text.enclosed ["#(" ")"])
:abstraction))
(def: #export (apply/* args func)
@@ -176,7 +176,7 @@
(|> args
(list\map ..code)
(text.join_with ..input_separator)
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
(format (:representation func))
:abstraction))
@@ -185,7 +185,7 @@
(|> args
(list\map ..code)
(text.join_with ..input_separator)
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
(format (:representation table) ":" method)
:abstraction))
@@ -328,10 +328,10 @@
(-> (List Var) Statement Expression)
(|> (format "function " (|> args
..locations
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(..nest (:representation body!))
text.new_line "end")
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
:abstraction))
(template [<name> <code>]
@@ -341,7 +341,7 @@
(format <code> " " (:representation name)
(|> args
..locations
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(..nest (:representation body!))
text.new_line "end")))]
diff --git a/stdlib/source/library/lux/target/php.lux b/stdlib/source/library/lux/target/php.lux
index 7cc266b98..e96d8fe85 100644
--- a/stdlib/source/library/lux/target/php.lux
+++ b/stdlib/source/library/lux/target/php.lux
@@ -37,11 +37,11 @@
(def: block
(-> Text Text)
- (|>> ..nest (text.enclose ["{" (format text.new_line "}")])))
+ (|>> ..nest (text.enclosed ["{" (format text.new_line "}")])))
(def: group
(-> Text Text)
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(abstract: #export (Code brand)
Text
@@ -176,7 +176,7 @@
(def: #export string
(-> Text Literal)
(|>> ..safe
- (text.enclose [text.double_quote text.double_quote])
+ (text.enclosed [text.double_quote text.double_quote])
:abstraction))
(def: arguments
diff --git a/stdlib/source/library/lux/target/python.lux b/stdlib/source/library/lux/target/python.lux
index 056426d2a..b7ac6a094 100644
--- a/stdlib/source/library/lux/target/python.lux
+++ b/stdlib/source/library/lux/target/python.lux
@@ -29,7 +29,7 @@
(def: expression
(-> Text Text)
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(for {@.old (as_is (ffi.import: java/lang/CharSequence)
(ffi.import: java/lang/String
@@ -170,7 +170,7 @@
(def: #export string
(-> Text Literal)
(|>> ..safe
- (text.enclose [text.double_quote text.double_quote])
+ (text.enclosed [text.double_quote text.double_quote])
:abstraction))
(def: #export unicode
diff --git a/stdlib/source/library/lux/target/ruby.lux b/stdlib/source/library/lux/target/ruby.lux
index 497cae831..7f6b66c74 100644
--- a/stdlib/source/library/lux/target/ruby.lux
+++ b/stdlib/source/library/lux/target/ruby.lux
@@ -192,7 +192,7 @@
(def: #export (array_range from to array)
(-> Expression Expression Expression Computation)
(|> (format (:representation from) ".." (:representation to))
- (text.enclose ["[" "]"])
+ (text.enclosed ["[" "]"])
(format (:representation array))
:abstraction))
@@ -200,7 +200,7 @@
(-> (List Expression) Literal)
(|>> (list\map (|>> :representation))
(text.join_with ..input_separator)
- (text.enclose ["[" "]"])
+ (text.enclosed ["[" "]"])
:abstraction))
(def: #export hash
@@ -208,7 +208,7 @@
(|>> (list\map (.function (_ [k v])
(format (:representation k) " => " (:representation v))))
(text.join_with ..input_separator)
- (text.enclose ["{" "}"])
+ (text.enclosed ["{" "}"])
:abstraction))
(def: #export (apply/* args func)
@@ -216,7 +216,7 @@
(|> args
(list\map (|>> :representation))
(text.join_with ..input_separator)
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
(format (:representation func))
:abstraction))
@@ -225,7 +225,7 @@
(|> args
(list\map (|>> :representation))
(text.join_with ..input_separator)
- (text.enclose ["[" "]"])
+ (text.enclosed ["[" "]"])
(format (:representation lambda))
:abstraction))
@@ -236,7 +236,7 @@
(def: #export (nth idx array)
(-> Expression Expression Access)
(|> (:representation idx)
- (text.enclose ["[" "]"])
+ (text.enclosed ["[" "]"])
(format (:representation array))
:abstraction))
@@ -245,7 +245,7 @@
(|> (format (:representation test) " ? "
(:representation then) " : "
(:representation else))
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
:abstraction))
(def: #export statement
@@ -356,7 +356,7 @@
(|> args
(list\map (|>> :representation))
(text.join_with ..input_separator)
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(..nest (:representation body!)))))
(def: #export (lambda name args body!)
@@ -364,9 +364,9 @@
(let [proc (|> (format (|> args
(list\map (|>> :representation))
(text.join_with ..input_separator)
- (text.enclose' "|"))
+ (text.enclosed' "|"))
(..nest (:representation body!)))
- (text.enclose ["{" "}"])
+ (text.enclosed ["{" "}"])
(format "lambda "))]
(|> (case name
#.None
@@ -374,7 +374,7 @@
(#.Some name)
(format (:representation name) " = " proc))
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
:abstraction)))
(template [<op> <name>]
diff --git a/stdlib/source/library/lux/target/scheme.lux b/stdlib/source/library/lux/target/scheme.lux
index f03f876b8..f2b855522 100644
--- a/stdlib/source/library/lux/target/scheme.lux
+++ b/stdlib/source/library/lux/target/scheme.lux
@@ -85,14 +85,14 @@
(format (|> mandatory
(list\map ..code)
(text.join_with " ")))
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
:abstraction))
#.None
(|> mandatory
(list\map ..code)
(text.join_with " ")
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
:abstraction)))
(def: #export nil
@@ -163,7 +163,7 @@
(list\map (|>> :representation nest))
(#.Item (:representation head))
(text.join_with nested_new_line)
- (text.enclose ["(" ")"])
+ (text.enclosed ["(" ")"])
:abstraction)))))
(def: #export (apply/* args func)
diff --git a/stdlib/source/library/lux/time.lux b/stdlib/source/library/lux/time.lux
index e726ad968..4a65fa4b8 100644
--- a/stdlib/source/library/lux/time.lux
+++ b/stdlib/source/library/lux/time.lux
@@ -148,7 +148,7 @@
(n.* utc_millis millis)))))))
)
-(def: (pad value)
+(def: (padded value)
(-> Nat Text)
(if (n.< 10 value)
(text\compose "0" (n\encode value))
@@ -160,7 +160,7 @@
(duration.merge space duration)
duration))
-(def: (encode_millis millis)
+(def: (millis_format millis)
(-> Nat Text)
(cond (n.= 0 millis) ""
(n.< 10 millis) ($_ text\compose ".00" (n\encode millis))
@@ -199,19 +199,19 @@
.nat
..of_millis))
-(def: (encode time)
+(def: (format time)
(-> Time Text)
(let [(^slots [#hour #minute #second #milli_second]) (..clock time)]
($_ text\compose
- (..pad hour)
- ..separator (..pad minute)
- ..separator (..pad second)
- (..encode_millis milli_second))))
+ (..padded hour)
+ ..separator (..padded minute)
+ ..separator (..padded second)
+ (..millis_format milli_second))))
(implementation: #export codec
{#.doc (doc "Based on ISO 8601."
"For example: 21:14:51.827")}
(Codec Text Time)
- (def: encode ..encode)
+ (def: encode ..format)
(def: decode (<text>.run ..parser)))
diff --git a/stdlib/source/library/lux/time/date.lux b/stdlib/source/library/lux/time/date.lux
index 79250a35e..1db01faf8 100644
--- a/stdlib/source/library/lux/time/date.lux
+++ b/stdlib/source/library/lux/time/date.lux
@@ -57,7 +57,7 @@
["Year" (\ //year.codec encode year)]
["Month" (n\encode (//month.number month))]))
-(def: (pad value)
+(def: (padded value)
(-> Nat Text)
(let [digits (n\encode value)]
(if (n.< 10 value)
@@ -179,19 +179,19 @@
utc_day ..section_parser]
(<>.lift (..date utc_year month utc_day))))
-(def: (encode value)
+(def: (format value)
(-> Date Text)
($_ text\compose
(\ //year.codec encode (..year value))
- ..separator (..pad (|> value ..month //month.number))
- ..separator (..pad (..day_of_month value))))
+ ..separator (..padded (|> value ..month //month.number))
+ ..separator (..padded (..day_of_month value))))
(implementation: #export codec
{#.doc (doc "Based on ISO 8601."
"For example: 2017-01-15")}
(Codec Text Date)
- (def: encode ..encode)
+ (def: encode ..format)
(def: decode (<text>.run ..parser)))
(def: days_per_leap
diff --git a/stdlib/source/library/lux/time/instant.lux b/stdlib/source/library/lux/time/instant.lux
index 8445ed977..e734e1bfc 100644
--- a/stdlib/source/library/lux/time/instant.lux
+++ b/stdlib/source/library/lux/time/instant.lux
@@ -124,7 +124,7 @@
//.of_millis
try.assumed))
-(def: (encode instant)
+(def: (format instant)
(-> Instant Text)
(let [[date time] (..split_date_time instant)
time (..clock_time time)]
@@ -152,7 +152,7 @@
"For example: 2017-01-15T21:14:51.827Z")}
(Codec Text Instant)
- (def: encode ..encode)
+ (def: encode ..format)
(def: decode (<text>.run ..parser)))
(def: #export now
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 f5e65f9bb..8588f52e0 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/analysis.lux
@@ -356,7 +356,7 @@
(|> members
(list\map %analysis)
(text.join_with " ")
- (text.enclose ["[" "]"])))
+ (text.enclosed ["[" "]"])))
(#Reference reference)
(reference.format reference)
@@ -370,8 +370,8 @@
(format (|> environment
(list\map %analysis)
(text.join_with " ")
- (text.enclose ["[" "]"])))
- (text.enclose ["(" ")"]))
+ (text.enclosed ["[" "]"])))
+ (text.enclosed ["(" ")"]))
(#Apply _)
(|> analysis
@@ -379,14 +379,14 @@
#.Item
(list\map %analysis)
(text.join_with " ")
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(#Extension name parameters)
(|> parameters
(list\map %analysis)
(text.join_with " ")
(format (%.text name) " ")
- (text.enclose ["(" ")"]))))
+ (text.enclosed ["(" ")"]))))
(template [<special> <general>]
[(type: #export <special>
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 9a34b72aa..99e1730f1 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
@@ -73,7 +73,7 @@
(#Bit value')
(|> value'
%.bit
- (text.enclose ["(#Bit " ")"]))
+ (text.enclosed ["(#Bit " ")"]))
(#Variant ?max_cases cases)
(|> cases
@@ -81,9 +81,9 @@
(list\map (function (_ [idx coverage])
(format (%.nat idx) " " (%coverage coverage))))
(text.join_with " ")
- (text.enclose ["{" "}"])
+ (text.enclosed ["{" "}"])
(format (%.nat (..cases ?max_cases)) " ")
- (text.enclose ["(#Variant " ")"]))
+ (text.enclosed ["(#Variant " ")"]))
(#Seq left right)
(format "(#Seq " (%coverage left) " " (%coverage right) ")")
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux
index a1a979555..93e1c6d1f 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/extension/analysis.lux
@@ -10,7 +10,7 @@
["." / #_
["#." lux]])
-(def: #export (bundle eval host-specific)
+(def: #export (bundle eval host_specific)
(-> Eval Bundle Bundle)
- (dictionary.merge host-specific
+ (dictionary.merge host_specific
(/lux.bundle eval)))
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 9f43c5f28..87c1e59cc 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
@@ -125,7 +125,7 @@
## ## (/.install "/" (binary (product.uncurry _.//2)))
## ## (/.install "%" (binary (product.uncurry _.rem/2)))
## ## (/.install "i64" (unary _.truncate/1))
-## (/.install "encode" (unary _.write-to-string/1))
+## (/.install "encode" (unary _.write_to_string/1))
## ## (/.install "decode" (unary //runtime.f64//decode))
## )))
@@ -139,7 +139,7 @@
## (def: (text//char [index text])
## (Binary (Expression Any))
-## (_.char-code/1 (_.char/2 [text index])))
+## (_.char_code/1 (_.char/2 [text index])))
(def: text_procs
Bundle
@@ -156,7 +156,7 @@
## (def: (io//log! message)
## (Unary (Expression Any))
-## (_.progn (list (_.write-line/1 message)
+## (_.progn (list (_.write_line/1 message)
## //runtime.unit)))
## (def: io_procs
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux
index bbb46cba2..5ceb08bc3 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/common_lisp/loop.lux
@@ -66,5 +66,5 @@
list.enumeration
(list\map (|>> product.left (n.+ offset) //case.register))
_.args)]]
- (in (_.progn (list (_.multiple-value-setq bindings (_.values/* argsO+))
+ (in (_.progn (list (_.multiple_value_setq bindings (_.values/* argsO+))
(_.go tag))))))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
index 20a26e9cb..e1c4dd247 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/js.lux
@@ -63,7 +63,7 @@
(//////phase\map _.return (/function.function statement expression archive abstraction))
))
-(exception: #export cannot-recur-as-an-expression)
+(exception: #export cannot_recur_as_an_expression)
(def: (expression archive synthesis)
Phase
@@ -101,7 +101,7 @@
(/loop.scope ..statement expression archive scope)
(^ (synthesis.loop/recur updates))
- (//////phase.except ..cannot-recur-as-an-expression [])
+ (//////phase.except ..cannot_recur_as_an_expression [])
(^ (synthesis.function/abstraction abstraction))
(/function.function ..statement expression archive abstraction)
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 2fbaa82f3..06ae68255 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
@@ -729,7 +729,6 @@
(_.and (|> value (<top_cmp> top)))))]
[within? _.<]
- [up_to? _.<=]
)
(def: (text_clip start end text)
@@ -761,14 +760,13 @@
(..some (i64::of_float (|> idx (_.+ startF))))))
..none))))
-(runtime: (text::clip text from to)
+(runtime: (text::clip text minimum additional)
(with_vars [length]
($_ _.then
(_.set! length (_.length text))
- (_.if ($_ _.and
- (|> to (within? length))
- (|> from (up_to? to)))
- (..some (text_clip (inc from) (inc to) text))
+ (_.set! to (_.+ additional minimum))
+ (_.if (within? length to)
+ (..some (text_clip (inc minimum) (inc to) text))
..none))))
(def: (char_at idx text)
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux
index 3f988197f..16b59870b 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/program.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/program.lux
@@ -28,7 +28,7 @@
Text
"")
-(exception: #export (cannot-find-program {modules (List Module)})
+(exception: #export (cannot_find_program {modules (List Module)})
(exception.report
["Modules" (exception.enumerate %.text modules)]))
@@ -43,15 +43,15 @@
[id (archive.id module archive)
[descriptor document] (archive.find module archive)]
(in [[module id] (get@ #descriptor.registry descriptor)])))))]
- (case (list.one (function (_ [[module module-id] registry])
+ (case (list.one (function (_ [[module module_id] registry])
(do maybe.monad
- [program-id (artifact.remember ..name registry)]
- (in [module-id program-id])))
+ [program_id (artifact.remember ..name registry)]
+ (in [module_id program_id])))
registries)
- (#.Some program-context)
- (in program-context)
+ (#.Some program_context)
+ (in program_context)
#.None
(|> registries
(list\map (|>> product.left product.left))
- (exception.except ..cannot-find-program)))))
+ (exception.except ..cannot_find_program)))))
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 87be39c2a..e304e237c 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/syntax.lux
@@ -345,7 +345,9 @@
(#.Left [[where <start> <source_code>]
error])))
-(def: no_exponent Offset 0)
+(def: no_exponent
+ Offset
+ 0)
(with_expansions [<int_output> (as_is (!number_output source_code start end int.decimal #.Int))
<frac_output> (as_is (!number_output source_code start end frac.decimal #.Frac))
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
index fdfebb72c..8559afe35 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/synthesis.lux
@@ -280,7 +280,7 @@
(list\map (function (_ [test then])
(format (<format> test) " " (%path' %then then))))
(text.join_with " ")
- (text.enclose ["(? " ")"]))])
+ (text.enclosed ["(? " ")"]))])
([#I64_Fork (|>> .int %.int)]
[#F64_Fork %.frac]
[#Text_Fork %.text])
@@ -314,7 +314,7 @@
(#Then then)
(|> (%then then)
- (text.enclose ["(! " ")"]))))
+ (text.enclosed ["(! " ")"]))))
(def: #export (%synthesis value)
(Format Synthesis)
@@ -336,13 +336,13 @@
(#analysis.Variant [lefts right? content])
(|> (%synthesis content)
(format (%.nat lefts) " " (%.bit right?) " ")
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
(#analysis.Tuple members)
(|> members
(list\map %synthesis)
(text.join_with " ")
- (text.enclose ["[" "]"])))
+ (text.enclosed ["[" "]"])))
(#Reference reference)
(reference.format reference)
@@ -355,36 +355,36 @@
(let [environment' (|> environment
(list\map %synthesis)
(text.join_with " ")
- (text.enclose ["[" "]"]))]
+ (text.enclosed ["[" "]"]))]
(|> (format environment' " " (%.nat arity) " " (%synthesis body))
- (text.enclose ["(#function " ")"])))
+ (text.enclosed ["(#function " ")"])))
(#Apply func args)
(|> args
(list\map %synthesis)
(text.join_with " ")
(format (%synthesis func) " ")
- (text.enclose ["(" ")"])))
+ (text.enclosed ["(" ")"])))
(#Branch branch)
(case branch
(#Let input register body)
(|> (format (%.nat register) " " (%synthesis input) " " (%synthesis body))
- (text.enclose ["(#let " ")"]))
+ (text.enclosed ["(#let " ")"]))
(#If test then else)
(|> (format (%synthesis test) " " (%synthesis then) " " (%synthesis else))
- (text.enclose ["(#if " ")"]))
+ (text.enclosed ["(#if " ")"]))
(#Get members record)
(|> (format (%.list (%path' %synthesis)
(list\map (|>> #Member #Access) members))
" " (%synthesis record))
- (text.enclose ["(#get " ")"]))
+ (text.enclosed ["(#get " ")"]))
(#Case input path)
(|> (format (%synthesis input) " " (%path' %synthesis path))
- (text.enclose ["(#case " ")"])))
+ (text.enclosed ["(#case " ")"])))
(#Loop loop)
(case loop
@@ -393,21 +393,21 @@
" " (|> (get@ #inits scope)
(list\map %synthesis)
(text.join_with " ")
- (text.enclose ["[" "]"]))
+ (text.enclosed ["[" "]"]))
" " (%synthesis (get@ #iteration scope)))
- (text.enclose ["(#loop " ")"]))
+ (text.enclosed ["(#loop " ")"]))
(#Recur args)
(|> args
(list\map %synthesis)
(text.join_with " ")
- (text.enclose ["(#recur " ")"]))))
+ (text.enclosed ["(#recur " ")"]))))
(#Extension [name args])
(|> (list\map %synthesis args)
(text.join_with " ")
(format (%.text name) " ")
- (text.enclose ["(" ")"]))))
+ (text.enclosed ["(" ")"]))))
(def: #export %path
(Format Path)
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 2239960c6..6af912b14 100644
--- a/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
+++ b/stdlib/source/library/lux/tool/compiler/meta/packager/scheme.lux
@@ -107,7 +107,7 @@
(get@ #descriptor.references)
set.to_list
(list.all (function (_ module) (dictionary.get module mapping)))
- (list\map (|>> ..module_file _.string _.load-relative/1))
+ (list\map (|>> ..module_file _.string _.load_relative/1))
(list\fold ..then bundle)
(: _.Expression)
_.code
diff --git a/stdlib/source/library/lux/type.lux b/stdlib/source/library/lux/type.lux
index 6b16939e4..f3f79adc2 100644
--- a/stdlib/source/library/lux/type.lux
+++ b/stdlib/source/library/lux/type.lux
@@ -84,7 +84,7 @@
(#.Primitive name params)
($_ text\compose
"(primitive "
- (text.enclose' text.double_quote name)
+ (text.enclosed' text.double_quote name)
(|> params
(list\map (|>> format (text\compose " ")))
(list\fold (function.flip text\compose) ""))
diff --git a/stdlib/source/library/lux/type/refinement.lux b/stdlib/source/library/lux/type/refinement.lux
index f2709d5e2..35189a071 100644
--- a/stdlib/source/library/lux/type/refinement.lux
+++ b/stdlib/source/library/lux/type/refinement.lux
@@ -21,9 +21,9 @@
(All [t]
(Ex [%]
(-> (Predicate t) (Refiner t %))))
- (function (_ un_refined)
- (if (predicate un_refined)
- (#.Some (:abstraction {#value un_refined
+ (function (_ value)
+ (if (predicate value)
+ (#.Some (:abstraction {#value value
#predicate predicate}))
#.None)))
@@ -32,7 +32,7 @@
(All [t %] (-> (Refined t %) <output>))
(|>> :representation (get@ <slot>)))]
- [un_refine t #value]
+ [value t #value]
[predicate (Predicate t) #predicate]
)
diff --git a/stdlib/source/library/lux/world/db/sql.lux b/stdlib/source/library/lux/world/db/sql.lux
index 93cd86b48..656e079b4 100644
--- a/stdlib/source/library/lux/world/db/sql.lux
+++ b/stdlib/source/library/lux/world/db/sql.lux
@@ -15,7 +15,7 @@
(def: parenthesize
(-> Text Text)
- (text.enclose ["(" ")"]))
+ (text.enclosed ["(" ")"]))
## Kind
(template [<declaration>]
@@ -37,17 +37,17 @@
[Source']
[DB']
- [No-Limit] [With-Limit]
- [No-Offset] [With-Offset]
+ [No_Limit] [With_Limit]
+ [No_Offset] [With_Offset]
[Order']
- [No-Order] [With-Order]
- [No-Group] [With-Group]
+ [No_Order] [With_Order]
+ [No_Group] [With_Group]
[(Query' order group limit offset)]
[Command']
- [No-Where] [With-Where] [Without-Where]
- [No-Having] [With-Having] [Without-Having]
+ [No_Where] [With_Where] [Without_Where]
+ [No_Having] [With_Having] [Without_Having]
[(Action' where having kind)]
[(Schema' kind)]
@@ -57,7 +57,7 @@
(type: #export Alias Text)
-(def: #export no-alias Alias "")
+(def: #export no_alias Alias "")
(abstract: #export (SQL kind)
Text
@@ -93,8 +93,8 @@
[Statement (Statement' Any)]
)
- (def: Base-Query (.type (Query No-Where No-Having No-Order No-Group No-Limit No-Offset)))
- (def: Any-Query (.type (Query Any Any Any Any Any Any)))
+ (def: Base_Query (.type (Query No_Where No_Having No_Order No_Group No_Limit No_Offset)))
+ (def: Any_Query (.type (Query Any Any Any Any Any Any)))
(def: #export read
{#.doc (doc "Only use this function for debugging purposes."
@@ -109,7 +109,7 @@
(def: enumerate
(-> (List (SQL Any)) Text)
(|>> (list\map (|>> :representation))
- (text.join-with ", ")))
+ (text.join_with ", ")))
## Value
(def: #export ? Placeholder (:abstraction "?"))
@@ -136,13 +136,13 @@
(..parenthesize (..enumerate parameters)))))
## Condition
- (template [<name> <sql-op>]
+ (template [<name> <sql_op>]
[(def: #export (<name> reference sample)
(-> Value Value Condition)
(:abstraction
(..parenthesize
(format (:representation sample)
- " " <sql-op> " "
+ " " <sql_op> " "
(:representation reference)))))]
[= "="]
@@ -171,12 +171,12 @@
" IN "
(..parenthesize (enumerate options)))))
- (template [<func-name> <sql-op>]
- [(def: #export (<func-name> left right)
+ (template [<func_name> <sql_op>]
+ [(def: #export (<func_name> left right)
(-> Condition Condition Condition)
(:abstraction
(format (..parenthesize (:representation left))
- " " <sql-op> " "
+ " " <sql_op> " "
(..parenthesize (:representation right)))))]
[and "AND"]
@@ -189,7 +189,7 @@
(|>> :representation ..parenthesize (format <sql> " ") :abstraction))]
[not Condition "NOT"]
- [exists Any-Query "EXISTS"]
+ [exists Any_Query "EXISTS"]
)
## Query
@@ -198,14 +198,14 @@
(-> <type> Source)
(|>> :representation <decoration> :abstraction))]
- [from-table Table (<|)]
- [from-view View (<|)]
- [from-query Any-Query ..parenthesize]
+ [from_table Table (<|)]
+ [from_view View (<|)]
+ [from_query Any_Query ..parenthesize]
)
- (template [<func-name> <op>]
- [(def: #export (<func-name> columns source)
- (-> (List [Column Alias]) Source Base-Query)
+ (template [<func_name> <op>]
+ [(def: #export (<func_name> columns source)
+ (-> (List [Column Alias]) Source Base_Query)
(:abstraction
(format <op>
" "
@@ -216,42 +216,42 @@
_
(|> columns
(list\map (.function (_ [column alias])
- (if (text\= ..no-alias alias)
+ (if (text\= ..no_alias alias)
(:representation column)
(format (:representation column) " AS " alias))))
- (text.join-with ", ")))
+ (text.join_with ", ")))
" FROM " (:representation source))))]
[select "SELECT"]
- [select-distinct "SELECT DISTINCT"]
+ [select_distinct "SELECT DISTINCT"]
)
- (template [<name> <join-text>]
+ (template [<name> <join_text>]
[(def: #export (<name> table condition prev)
- (-> Table Condition Base-Query Base-Query)
+ (-> Table Condition Base_Query Base_Query)
(:abstraction
(format (:representation prev)
- " " <join-text> " "
+ " " <join_text> " "
(:representation table)
" ON " (:representation condition))))]
- [inner-join "INNER JOIN"]
- [left-join "LEFT JOIN"]
- [right-join "RIGHT JOIN"]
- [full-outer-join "FULL OUTER JOIN"]
+ [inner_join "INNER JOIN"]
+ [left_join "LEFT JOIN"]
+ [right_join "RIGHT JOIN"]
+ [full_outer_join "FULL OUTER JOIN"]
)
- (template [<function> <sql-op>]
+ (template [<function> <sql_op>]
[(def: #export (<function> left right)
- (-> Any-Query Any-Query (Query Without-Where Without-Having No-Order No-Group No-Limit No-Offset))
+ (-> Any_Query Any_Query (Query Without_Where Without_Having No_Order No_Group No_Limit No_Offset))
(:abstraction
(format (:representation left)
- " " <sql-op> " "
+ " " <sql_op> " "
(:representation right))))]
[union "UNION"]
- [union-all "UNION ALL"]
+ [union_all "UNION ALL"]
[intersect "INTERSECT"]
)
@@ -265,12 +265,12 @@
(%.nat value))))]
[limit "LIMIT" [where having order group offset]
- (Query where having order group No-Limit offset)
- (Query where having order group With-Limit offset)]
+ (Query where having order group No_Limit offset)
+ (Query where having order group With_Limit offset)]
[offset "OFFSET" [where having order group limit]
- (Query where having order group limit No-Offset)
- (Query where having order group limit With-Offset)]
+ (Query where having order group limit No_Offset)
+ (Query where having order group limit With_Offset)]
)
(template [<name> <sql>]
@@ -282,11 +282,11 @@
[descending "DESC"]
)
- (def: #export (order-by pairs query)
+ (def: #export (order_by pairs query)
(All [where having group limit offset]
(-> (List [Value Order])
- (Query where having No-Order group limit offset)
- (Query where having With-Order group limit offset)))
+ (Query where having No_Order group limit offset)
+ (Query where having With_Order group limit offset)))
(case pairs
#.End
(|> query :representation :abstraction)
@@ -298,13 +298,13 @@
(|> pairs
(list\map (.function (_ [value order])
(format (:representation value) " " (:representation order))))
- (text.join-with ", "))))))
+ (text.join_with ", "))))))
- (def: #export (group-by pairs query)
+ (def: #export (group_by pairs query)
(All [where having order limit offset]
(-> (List Value)
- (Query where having order No-Group limit offset)
- (Query where having order With-Group limit offset)))
+ (Query where having order No_Group limit offset)
+ (Query where having order With_Group limit offset)))
(case pairs
#.End
(|> query :representation :abstraction)
@@ -317,18 +317,18 @@
## Command
(def: #export (insert table columns rows)
- (-> Table (List Column) (List (List Value)) (Command Without-Where Without-Having))
+ (-> Table (List Column) (List (List Value)) (Command Without_Where Without_Having))
(:abstraction
(format "INSERT INTO " (:representation table) " "
(..parenthesize (..enumerate columns))
" VALUES "
(|> rows
(list\map (|>> ..enumerate ..parenthesize))
- (text.join-with ", "))
+ (text.join_with ", "))
)))
(def: #export (update table pairs)
- (-> Table (List [Column Value]) (Command No-Where No-Having))
+ (-> Table (List [Column Value]) (Command No_Where No_Having))
(:abstraction (format "UPDATE " (:representation table)
(case pairs
#.End
@@ -338,16 +338,16 @@
(format " SET " (|> pairs
(list\map (.function (_ [column value])
(format (:representation column) "=" (:representation value))))
- (text.join-with ", ")))))))
+ (text.join_with ", ")))))))
(def: #export delete
- (-> Table (Command No-Where No-Having))
+ (-> Table (Command No_Where No_Having))
(|>> :representation (format "DELETE FROM ") :abstraction))
## Action
(def: #export (where condition prev)
(All [kind having]
- (-> Condition (Action No-Where having kind) (Action With-Where having kind)))
+ (-> Condition (Action No_Where having kind) (Action With_Where having kind)))
(:abstraction
(format (:representation prev)
" WHERE "
@@ -355,7 +355,7 @@
(def: #export (having condition prev)
(All [where kind]
- (-> Condition (Action where No-Having kind) (Action where With-Having kind)))
+ (-> Condition (Action where No_Having kind) (Action where With_Having kind)))
(:abstraction
(format (:representation prev)
" HAVING "
@@ -373,7 +373,7 @@
(format (:representation attr) " " <attr>)))]
[unique "UNIQUE"]
- [not-null "NOT NULL"]
+ [not_null "NOT NULL"]
[stored "STORED"]
)
@@ -382,27 +382,27 @@
(:abstraction
(format (:representation attr) " DEFAULT " (:representation value))))
- (def: #export (define-column name type)
+ (def: #export (define_column name type)
(-> Column (Schema Value) (Schema Column))
(:abstraction
(format (:representation name) " " (:representation type))))
- (def: #export (auto-increment offset column)
+ (def: #export (auto_increment offset column)
(-> Int (Schema Column) (Schema Column))
(:abstraction
(format (:representation column) " AUTO_INCREMENT=" (:representation (..int offset)))))
- (def: #export (create-table or-replace? table columns)
+ (def: #export (create_table or_replace? table columns)
(-> Bit Table (List (Schema Column)) Definition)
- (let [command (if or-replace?
+ (let [command (if or_replace?
"CREATE OR REPLACE TABLE"
"CREATE TABLE IF NOT EXISTS")]
(:abstraction
(format command " " (:representation table)
(..parenthesize (..enumerate columns))))))
- (def: #export (create-table-as table query)
- (-> Table Any-Query Definition)
+ (def: #export (create_table_as table query)
+ (-> Table Any_Query Definition)
(:abstraction
(format "CREATE TABLE " (:representation table) " AS " (:representation query))))
@@ -416,12 +416,12 @@
[truncate "TRUNCATE"]
)
- (def: #export (add-column table column)
+ (def: #export (add_column table column)
(-> Table (Schema Column) Definition)
(:abstraction
(format "ALTER TABLE " (:representation table) " ADD " (:representation column))))
- (def: #export (drop-column table column)
+ (def: #export (drop_column table column)
(-> Table Column Definition)
(:abstraction
(format "ALTER TABLE " (:representation table) " DROP COLUMN " (:representation column))))
@@ -443,22 +443,22 @@
(-> <type> Definition)
(|>> :representation (format <sql> " ") :abstraction))]
- [create-db DB "CREATE DATABASE"]
- [drop-db DB "DROP DATABASE"]
- [drop-view View "DROP VIEW"]
+ [create_db DB "CREATE DATABASE"]
+ [drop_db DB "DROP DATABASE"]
+ [drop_view View "DROP VIEW"]
)
(template [<name> <sql>]
[(def: #export (<name> view query)
- (-> View Any-Query Definition)
+ (-> View Any_Query Definition)
(:abstraction
(format <sql> " " (:representation view) " AS " (:representation query))))]
- [create-view "CREATE VIEW"]
- [create-or-replace-view "CREATE OR REPLACE VIEW"]
+ [create_view "CREATE VIEW"]
+ [create_or_replace_view "CREATE OR REPLACE VIEW"]
)
- (def: #export (create-index index table unique? columns)
+ (def: #export (create_index index table unique? columns)
(-> Index Table Bit (List Column) Definition)
(:abstraction
(format "CREATE " (if unique? "UNIQUE" "") " INDEX " (:representation index)
@@ -466,7 +466,7 @@
(def: #export (with alias query body)
(All [where having order group limit offset]
- (-> Table Any-Query
+ (-> Table Any_Query
(Query where having order group limit offset)
(Query where having order group limit offset)))
(:abstraction
diff --git a/stdlib/source/library/lux/world/net/http/cookie.lux b/stdlib/source/library/lux/world/net/http/cookie.lux
index 1254923b8..2c5965338 100644
--- a/stdlib/source/library/lux/world/net/http/cookie.lux
+++ b/stdlib/source/library/lux/world/net/http/cookie.lux
@@ -20,18 +20,19 @@
["." // (#+ Header)
["." header]])
-(type: #export Directive (-> Text Text))
+(type: #export Directive
+ (-> Text Text))
(def: (directive extension)
(-> Text Directive)
- (function (_ so-far)
- (format so-far "; " extension)))
+ (function (_ so_far)
+ (format so_far "; " extension)))
(def: #export (set name value)
(-> Text Text Header)
(header.add "Set-Cookie" (format name "=" value)))
-(def: #export (max-age duration)
+(def: #export (max_age duration)
(-> Duration Directive)
(let [seconds (duration.query duration.second duration)]
(..directive (format "Max-Age=" (if (i.< +0 seconds)
@@ -53,15 +54,15 @@
(..directive <tag>))]
[secure "Secure"]
- [http-only "HttpOnly"]
+ [http_only "HttpOnly"]
)
-(type: #export CSRF-Policy
+(type: #export CSRF_Policy
#Strict
#Lax)
-(def: #export (same-site policy)
- (-> CSRF-Policy Directive)
+(def: #export (same_site policy)
+ (-> CSRF_Policy Directive)
(..directive (format "SameSite=" (case policy
#Strict "Strict"
#Lax "Lax"))))
@@ -69,9 +70,9 @@
(def: (cookie context)
(-> Context (Parser Context))
(do p.monad
- [key (l.slice (l.many! (l.none-of! "=")))
+ [key (l.slice (l.many! (l.none_of! "=")))
_ (l.this "=")
- value (l.slice (l.many! (l.none-of! ";")))]
+ value (l.slice (l.many! (l.none_of! ";")))]
(in (dictionary.put key value context))))
(def: (cookies context)
diff --git a/stdlib/source/library/lux/world/net/http/query.lux b/stdlib/source/library/lux/world/net/http/query.lux
index 4ee1c2cc2..0f78ba5e3 100644
--- a/stdlib/source/library/lux/world/net/http/query.lux
+++ b/stdlib/source/library/lux/world/net/http/query.lux
@@ -22,7 +22,7 @@
(p.rec
(function (_ component)
(do {! p.monad}
- [head (l.some (l.none-of "+%&;"))]
+ [head (l.some (l.none_of "+%&;"))]
($_ p.either
(p.after (p.either l.end
(l.this "&"))
@@ -35,7 +35,7 @@
[_ (l.this "%")
code (|> (l.exactly 2 l.hexadecimal)
(p.codec nat.hex)
- (\ ! map text.from-code))
+ (\ ! map text.from_code))
tail component]
(in (format head code tail))))))))
@@ -46,7 +46,7 @@
[_ l.end]
(in context))
(do {! p.monad}
- [key (l.some (l.none-of "=&;"))
+ [key (l.some (l.none_of "=&;"))
key (l.local key ..component)]
(p.either (do !
[_ (l.this "=")
@@ -54,7 +54,7 @@
(form (dictionary.put key value context)))
(do !
[_ ($_ p.or
- (l.one-of "&;")
+ (l.one_of "&;")
l.end)]
(form (dictionary.put key "" context)))))
## if invalid form data, just stop parsing...
diff --git a/stdlib/source/library/lux/world/net/http/route.lux b/stdlib/source/library/lux/world/net/http/route.lux
index 39d66cba0..a390c51bb 100644
--- a/stdlib/source/library/lux/world/net/http/route.lux
+++ b/stdlib/source/library/lux/world/net/http/route.lux
@@ -23,7 +23,7 @@
(server request)
_
- (async.resolved //response.not-found))))]
+ (async.resolved //response.not_found))))]
[#//.HTTP http]
[#//.HTTPS https]
@@ -38,7 +38,7 @@
(server request)
_
- (async.resolved //response.not-found))))]
+ (async.resolved //response.not_found))))]
[#//.Get get]
[#//.Post post]
@@ -54,14 +54,14 @@
(def: #export (uri path server)
(-> URI Server Server)
(function (_ [identification protocol resource message])
- (if (text.starts-with? path (get@ #//.uri resource))
+ (if (text.starts_with? path (get@ #//.uri resource))
(server [identification
protocol
(update@ #//.uri
(|>> (text.clip' (text.size path)) maybe.assume)
resource)
message])
- (async.resolved //response.not-found))))
+ (async.resolved //response.not_found))))
(def: #export (or primary alternative)
(-> Server Server Server)
@@ -69,6 +69,6 @@
(do async.monad
[response (primary request)
#let [[status message] response]]
- (if (n.= //status.not-found status)
+ (if (n.= //status.not_found status)
(alternative request)
(in response)))))
diff --git a/stdlib/source/library/lux/world/service/authentication.lux b/stdlib/source/library/lux/world/service/authentication.lux
index 4c66ddc1c..7cce79b8e 100644
--- a/stdlib/source/library/lux/world/service/authentication.lux
+++ b/stdlib/source/library/lux/world/service/authentication.lux
@@ -6,20 +6,20 @@
[security
[capability (#+ Capability)]]]]])
-(type: #export (Can-Register ! account secret value)
+(type: #export (Can_Register ! account secret value)
(Capability [account secret value] (! (Try Any))))
-(type: #export (Can-Authenticate ! account secret value)
+(type: #export (Can_Authenticate ! account secret value)
(Capability [account secret] (! (Try value))))
-(type: #export (Can-Reset ! account secret)
+(type: #export (Can_Reset ! account secret)
(Capability [account secret] (! (Try Any))))
-(type: #export (Can-Forget ! account)
+(type: #export (Can_Forget ! account)
(Capability [account] (! (Try Any))))
(type: #export (Service ! account secret value)
- {#can-register (Can-Register ! account secret value)
- #can-authenticate (Can-Authenticate ! account secret value)
- #can-reset (Can-Reset ! account secret)
- #can-forget (Can-Forget ! account)})
+ {#can_register (Can_Register ! account secret value)
+ #can_authenticate (Can_Authenticate ! account secret value)
+ #can_reset (Can_Reset ! account secret)
+ #can_forget (Can_Forget ! account)})
diff --git a/stdlib/source/library/lux/world/service/crud.lux b/stdlib/source/library/lux/world/service/crud.lux
index bd47744f4..00eb870c5 100644
--- a/stdlib/source/library/lux/world/service/crud.lux
+++ b/stdlib/source/library/lux/world/service/crud.lux
@@ -14,20 +14,20 @@
{#created Instant
#updated Instant})
-(capability: #export (Can-Create ! entity)
- (can-create [Instant entity] (! (Try ID))))
+(capability: #export (Can_Create ! entity)
+ (can_create [Instant entity] (! (Try ID))))
-(capability: #export (Can-Retrieve ! entity)
- (can-retrieve ID (! (Try [Time entity]))))
+(capability: #export (Can_Retrieve ! entity)
+ (can_retrieve ID (! (Try [Time entity]))))
-(capability: #export (Can-Update ! entity)
- (can-update [ID Instant entity] (! (Try Any))))
+(capability: #export (Can_Update ! entity)
+ (can_update [ID Instant entity] (! (Try Any))))
-(capability: #export (Can-Delete ! entity)
- (can-delete ID (! (Try Any))))
+(capability: #export (Can_Delete ! entity)
+ (can_delete ID (! (Try Any))))
(type: #export (CRUD ! entity)
- {#can-create (Can-Create ! entity)
- #can-retrieve (Can-Retrieve ! entity)
- #can-update (Can-Update ! entity)
- #can-delete (Can-Delete ! entity)})
+ {#can_create (Can_Create ! entity)
+ #can_retrieve (Can_Retrieve ! entity)
+ #can_update (Can_Update ! entity)
+ #can_delete (Can_Delete ! entity)})
diff --git a/stdlib/source/library/lux/world/service/inventory.lux b/stdlib/source/library/lux/world/service/inventory.lux
index b6f023075..f5b0dc807 100644
--- a/stdlib/source/library/lux/world/service/inventory.lux
+++ b/stdlib/source/library/lux/world/service/inventory.lux
@@ -12,20 +12,20 @@
{#owner ID
#property ID})
-(capability: #export (Can-Own !)
- (can-own Ownership (! (Try Any))))
+(capability: #export (Can_Own !)
+ (can_own Ownership (! (Try Any))))
-(capability: #export (Can-Disown !)
- (can-disown Ownership (! (Try Any))))
+(capability: #export (Can_Disown !)
+ (can_disown Ownership (! (Try Any))))
-(capability: #export (Can-Check !)
- (can-check Ownership (! (Try Bit))))
+(capability: #export (Can_Check !)
+ (can_check Ownership (! (Try Bit))))
-(capability: #export (Can-List-Property !)
- (can-list-property ID (! (Try (List ID)))))
+(capability: #export (Can_List_Property !)
+ (can_list_property ID (! (Try (List ID)))))
(type: #export (Inventory !)
- {#can-own (Can-Own !)
- #can-disown (Can-Disown !)
- #can-check (Can-Check !)
- #can-list-property (Can-List-Property !)})
+ {#can_own (Can_Own !)
+ #can_disown (Can_Disown !)
+ #can_check (Can_Check !)
+ #can_list_property (Can_List_Property !)})
diff --git a/stdlib/source/library/lux/world/service/journal.lux b/stdlib/source/library/lux/world/service/journal.lux
index ba42af209..b82fdd83a 100644
--- a/stdlib/source/library/lux/world/service/journal.lux
+++ b/stdlib/source/library/lux/world/service/journal.lux
@@ -40,12 +40,12 @@
(text\= (get@ #where reference) (get@ #where sample))
(instant\= (get@ #when reference) (get@ #when sample)))))
-(capability: #export (Can-Write ! a)
- (can-write (Entry a) (! (Try Any))))
+(capability: #export (Can_Write ! a)
+ (can_write (Entry a) (! (Try Any))))
-(capability: #export (Can-Read ! a)
- (can-read Range (! (Try (List (Entry a))))))
+(capability: #export (Can_Read ! a)
+ (can_read Range (! (Try (List (Entry a))))))
(type: #export (Journal ! a)
- {#can-write (Can-Write ! a)
- #can-read (Can-Read ! a)})
+ {#can_write (Can_Write ! a)
+ #can_read (Can_Read ! a)})
diff --git a/stdlib/source/library/lux/world/service/mail.lux b/stdlib/source/library/lux/world/service/mail.lux
index 2b2cc9dd1..8a5921e83 100644
--- a/stdlib/source/library/lux/world/service/mail.lux
+++ b/stdlib/source/library/lux/world/service/mail.lux
@@ -8,12 +8,12 @@
[security
["!" capability (#+ capability:)]]]]])
-(capability: #export (Can-Send ! address message)
- (can-send [address message] (! (Try Any))))
+(capability: #export (Can_Send ! address message)
+ (can_send [address message] (! (Try Any))))
-(capability: #export (Can-Subscribe ! address message)
- (can-subscribe [address] (! (Try (Channel message)))))
+(capability: #export (Can_Subscribe ! address message)
+ (can_subscribe [address] (! (Try (Channel message)))))
(type: #export (Service ! address message)
- {#can-send (Can-Send ! address message)
- #can-subscribe (Can-Subscribe ! address message)})
+ {#can_send (Can_Send ! address message)
+ #can_subscribe (Can_Subscribe ! address message)})
diff --git a/stdlib/source/library/lux/world/shell.lux b/stdlib/source/library/lux/world/shell.lux
index c9f524a69..8c4614a32 100644
--- a/stdlib/source/library/lux/world/shell.lux
+++ b/stdlib/source/library/lux/world/shell.lux
@@ -150,7 +150,7 @@
(..safe_common_command replacer))
safe_argument (: (Sanitizer Argument)
(|>> (..replace "'" replacer)
- (text.enclose' "'")))]
+ (text.enclosed' "'")))]
(..policy safe_command safe_argument)))
(def: windows_policy
@@ -164,7 +164,7 @@
(|>> (..replace "%" replacer)
(..replace "!" replacer)
(..replace text.double_quote replacer)
- (text.enclose' text.double_quote)))]
+ (text.enclosed' text.double_quote)))]
(..policy safe_command safe_argument)))
(with_expansions [<jvm> (as_is (import: java/lang/String
diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux
index e429ff86f..fd66e6d61 100644
--- a/stdlib/source/program/scriptum.lux
+++ b/stdlib/source/program/scriptum.lux
@@ -454,7 +454,7 @@
(-> [Text Text] Text Text)
(|> block
(text.split_all_with text.new_line)
- (list\map (text.enclose pre+post))
+ (list\map (text.enclosed pre+post))
(text.join_with text.new_line)))
(def: (document_module [[module_name module] organization])
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux
index bfdc93f30..11e3b6c73 100644
--- a/stdlib/source/test/lux.lux
+++ b/stdlib/source/test/lux.lux
@@ -22,11 +22,13 @@
["%" format (#+ format)]]
[collection
["." list]]]
- [macro
+ ["." macro
["." code ("#\." equivalence)]]
["." math
["." random (#+ Random) ("#\." functor)]
[number
+ [i8 (#+)]
+ [i16 (#+)]
["n" nat]
["i" int]
["r" rev]
@@ -989,6 +991,36 @@
(and (is? expected (identity/constant expected))
(is? expected (identity/function expected))))))
+(.refer "library/lux/target" #*)
+(.refer "library/lux/macro" #all)
+(.refer "library/lux/math/number/nat" #_)
+(.refer "library/lux/math/number/int" #nothing)
+(.refer "library/lux/math/number/rev" (#+ /4096))
+(.refer "library/lux/math/number/frac" (#only positive_infinity))
+(.refer "library/lux/math/number/i8" (#- equivalence width i8 i64))
+(.refer "library/lux/math/number/i16" (#exclude equivalence width i16 i64))
+
+(def: for_import
+ Test
+ (let [can_access? (: (All [a] (-> a a Bit))
+ (function (_ global local)
+ (is? global local)))]
+ ($_ _.and
+ (_.cover [/.refer]
+ (and (can_access? library/lux/target.jvm
+ jvm)
+ (can_access? library/lux/macro.single_expansion
+ single_expansion)
+ (can_access? library/lux/math/number/rev./4096
+ /4096)
+ (can_access? library/lux/math/number/frac.positive_infinity
+ positive_infinity)
+ (can_access? library/lux/math/number/i8.I8
+ I8)
+ (can_access? library/lux/math/number/i16.I16
+ I16)))
+ )))
+
(def: test
Test
(<| (_.covering /._)
@@ -1013,6 +1045,7 @@
..for_case
..for_control_flow
..for_def:
+ ..for_import
..sub_tests
)))
diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux
index 1e6dd9a48..3dff3aba1 100644
--- a/stdlib/source/test/lux/control/concurrency/semaphore.lux
+++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux
@@ -150,7 +150,7 @@
[_ (#.Some limit)]
(and (n.> 0 raw)
- (n.= raw (refinement.un_refine limit)))
+ (n.= raw (refinement.value limit)))
_
false)))
diff --git a/stdlib/source/test/lux/control/parser.lux b/stdlib/source/test/lux/control/parser.lux
index b71ab1256..7370e0db0 100644
--- a/stdlib/source/test/lux/control/parser.lux
+++ b/stdlib/source/test/lux/control/parser.lux
@@ -220,13 +220,13 @@
actual)))))
(_.cover [/.between]
(and (|> (list\map code.nat expected+)
- (/.run (/.between times variadic <code>.nat))
+ (/.run (/.between times (n.- times variadic) <code>.nat))
(match actual
(\ (list.equivalence n.equivalence) =
expected+
actual)))
(|> (list\map code.nat (list.take times expected+))
- (/.run (/.between times variadic <code>.nat))
+ (/.run (/.between times (n.- times variadic) <code>.nat))
(match actual
(\ (list.equivalence n.equivalence) =
(list.take times expected+)
diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux
index 84758e83b..055a2f858 100644
--- a/stdlib/source/test/lux/control/parser/text.lux
+++ b/stdlib/source/test/lux/control/parser/text.lux
@@ -282,13 +282,13 @@
second octal
third octal]
(_.cover [/.between /.between!]
- (and (..should_pass (format first second) (/.between 2 3 /.octal))
- (..should_pass (format first second third) (/.between 2 3 /.octal))
- (..should_fail (format first) (/.between 2 3 /.octal))
+ (and (..should_pass (format first second) (/.between 2 1 /.octal))
+ (..should_pass (format first second third) (/.between 2 1 /.octal))
+ (..should_fail (format first) (/.between 2 1 /.octal))
- (..should_pass! (format first second) (/.between! 2 3 octal!))
- (..should_pass! (format first second third) (/.between! 2 3 octal!))
- (..should_fail (format first) (/.between! 2 3 octal!)))))
+ (..should_pass! (format first second) (/.between! 2 1 octal!))
+ (..should_pass! (format first second third) (/.between! 2 1 octal!))
+ (..should_fail (format first) (/.between! 2 1 octal!)))))
)))
(def: #export test
diff --git a/stdlib/source/test/lux/control/parser/tree.lux b/stdlib/source/test/lux/control/parser/tree.lux
index 4b3bf2cad..25f6c350c 100644
--- a/stdlib/source/test/lux/control/parser/tree.lux
+++ b/stdlib/source/test/lux/control/parser/tree.lux
@@ -61,7 +61,7 @@
[expected random.nat]
(_.cover [/.run']
(|> (/.run' /.value
- (zipper.zip (tree.leaf expected)))
+ (zipper.zipper (tree.leaf expected)))
(!expect (^multi (#try.Success actual)
(n.= expected actual))))))
(!cover [/.down]
diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux
index 5f62bac4b..bd9833aec 100644
--- a/stdlib/source/test/lux/control/remember.lux
+++ b/stdlib/source/test/lux/control/remember.lux
@@ -72,10 +72,10 @@
message (product.right (random.run prng ..message))
expected (product.right (random.run prng ..focus))]
(do meta.monad
- [should_fail0 (..attempt (macro.expand (to_remember macro yesterday message #.None)))
- should_fail1 (..attempt (macro.expand (to_remember macro yesterday message (#.Some expected))))
- should_succeed0 (..attempt (macro.expand (to_remember macro tomorrow message #.None)))
- should_succeed1 (..attempt (macro.expand (to_remember macro tomorrow message (#.Some expected))))]
+ [should_fail0 (..attempt (macro.expansion (to_remember macro yesterday message #.None)))
+ should_fail1 (..attempt (macro.expansion (to_remember macro yesterday message (#.Some expected))))
+ should_succeed0 (..attempt (macro.expansion (to_remember macro tomorrow message #.None)))
+ should_succeed1 (..attempt (macro.expansion (to_remember macro tomorrow message (#.Some expected))))]
(in (list (code.bit (and (case should_fail0
(#try.Failure error)
(and (test_failure yesterday message #.None error)
diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux
index 2374b2f21..a2fc3911d 100644
--- a/stdlib/source/test/lux/data/collection/list.lux
+++ b/stdlib/source/test/lux/data/collection/list.lux
@@ -280,9 +280,9 @@
sample/1 ..random
sample/2 ..random]
($_ _.and
- (_.cover [/.as_pairs]
+ (_.cover [/.pairs]
(n.= (n./ 2 (/.size sample/0))
- (/.size (/.as_pairs sample/0))))
+ (/.size (/.pairs sample/0))))
(_.cover [/.zipped/2]
(let [zipped (/.zipped/2 sample/0 sample/1)
zipped::size (/.size zipped)
@@ -412,7 +412,7 @@
(let [sample+ (/.interpose separator sample)]
(and (n.= (|> (/.size sample) (n.* 2) dec)
(/.size sample+))
- (|> sample+ /.as_pairs (/.every? (|>> product.right (n.= separator))))))))
+ (|> sample+ /.pairs (/.every? (|>> product.right (n.= separator))))))))
(_.cover [/.iterate]
(or (/.empty? sample)
(let [size (/.size sample)]
diff --git a/stdlib/source/test/lux/data/collection/tree/zipper.lux b/stdlib/source/test/lux/data/collection/tree/zipper.lux
index 35b55f4bf..df7333db5 100644
--- a/stdlib/source/test/lux/data/collection/tree/zipper.lux
+++ b/stdlib/source/test/lux/data/collection/tree/zipper.lux
@@ -33,14 +33,14 @@
($_ _.and
(_.cover [/.down]
(|> (tree.branch dummy (list (tree.leaf expected)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[/.value (n.= expected) in])
(maybe.default false)))
(_.cover [/.up]
(|> (tree.branch expected (list (tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[/.up]
@@ -48,7 +48,7 @@
(maybe.default false)))
(_.cover [/.right]
(|> (tree.branch dummy (list (tree.leaf dummy) (tree.leaf expected)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[/.right]
@@ -60,7 +60,7 @@
(tree.leaf dummy)
(tree.leaf dummy)
(tree.leaf expected)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[/.rightmost]
@@ -68,7 +68,7 @@
(maybe.default false)))
(_.cover [/.left]
(|> (tree.branch dummy (list (tree.leaf expected) (tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[/.right]
@@ -81,7 +81,7 @@
(tree.leaf dummy)
(tree.leaf dummy)
(tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[/.rightmost]
@@ -92,7 +92,7 @@
(and (|> (tree.branch dummy
(list (tree.leaf expected)
(tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.next]
[/.value (n.= expected) in])
@@ -100,7 +100,7 @@
(|> (tree.branch dummy
(list (tree.leaf dummy)
(tree.leaf expected)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.next]
[/.next]
@@ -112,7 +112,7 @@
(tree.leaf dummy)
(tree.leaf dummy)
(tree.leaf expected)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.end]
[/.value (n.= expected) in])
@@ -123,7 +123,7 @@
(tree.leaf dummy)
(tree.leaf dummy)
(tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.end]
[/.start]
@@ -133,7 +133,7 @@
(and (|> (tree.branch expected
(list (tree.leaf dummy)
(tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.next]
[/.previous]
@@ -142,7 +142,7 @@
(|> (tree.branch dummy
(list (tree.leaf expected)
(tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.next]
[/.next]
@@ -163,45 +163,45 @@
(^open "list\.") (list.equivalence n.equivalence)]]
($_ _.and
(_.for [/.equivalence]
- ($equivalence.spec (/.equivalence n.equivalence) (\ ! map (|>> product.right /.zip) (//.tree random.nat))))
+ ($equivalence.spec (/.equivalence n.equivalence) (\ ! map (|>> product.right /.zipper) (//.tree random.nat))))
(_.for [/.functor]
- ($functor.spec (|>> tree.leaf /.zip) /.equivalence /.functor))
+ ($functor.spec (|>> tree.leaf /.zipper) /.equivalence /.functor))
(_.for [/.comonad]
- ($comonad.spec (|>> tree.leaf /.zip) /.equivalence /.comonad))
+ ($comonad.spec (|>> tree.leaf /.zipper) /.equivalence /.comonad))
- (_.cover [/.zip /.unzip]
- (|> sample /.zip /.unzip (tree\= sample)))
+ (_.cover [/.zipper /.tree]
+ (|> sample /.zipper /.tree (tree\= sample)))
(_.cover [/.start?]
- (|> sample /.zip /.start?))
+ (|> sample /.zipper /.start?))
(_.cover [/.leaf?]
- (/.leaf? (/.zip (tree.leaf expected))))
+ (/.leaf? (/.zipper (tree.leaf expected))))
(_.cover [/.branch?]
- (and (/.branch? (/.zip (tree.branch expected (list (tree.leaf expected)))))
- (not (/.branch? (/.zip (tree.branch expected (list)))))))
+ (and (/.branch? (/.zipper (tree.branch expected (list (tree.leaf expected)))))
+ (not (/.branch? (/.zipper (tree.branch expected (list)))))))
(_.cover [/.value]
- (and (n.= expected (/.value (/.zip (tree.leaf expected))))
- (n.= expected (/.value (/.zip (tree.branch expected (list (tree.leaf expected))))))))
+ (and (n.= expected (/.value (/.zipper (tree.leaf expected))))
+ (n.= expected (/.value (/.zipper (tree.branch expected (list (tree.leaf expected))))))))
(_.cover [/.set]
- (|> (/.zip (tree.leaf dummy))
+ (|> (/.zipper (tree.leaf dummy))
(/.set expected)
/.value
(n.= expected)))
(_.cover [/.update]
- (|> (/.zip (tree.leaf expected))
+ (|> (/.zipper (tree.leaf expected))
(/.update inc)
/.value
(n.= (inc expected))))
..move
(_.cover [/.end?]
- (or (/.end? (/.zip sample))
+ (or (/.end? (/.zipper sample))
(|> sample
- /.zip
+ /.zipper
/.end
(maybe\map /.end?)
(maybe.default false))))
(_.cover [/.interpose]
(let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zip
+ /.zipper
(/.interpose expected))]
(and (n.= dummy (/.value cursor))
(|> cursor
@@ -217,7 +217,7 @@
(maybe.default false)))))
(_.cover [/.adopt]
(let [cursor (|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zip
+ /.zipper
(/.adopt expected))]
(and (n.= dummy (/.value cursor))
(|> cursor
@@ -233,7 +233,7 @@
(maybe.default false)))))
(_.cover [/.insert_left]
(|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[(/.insert_left expected)]
@@ -242,7 +242,7 @@
(maybe.default false)))
(_.cover [/.insert_right]
(|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[(/.insert_right expected)]
@@ -251,7 +251,7 @@
(maybe.default false)))
(_.cover [/.remove]
(|> (tree.branch dummy (list (tree.leaf dummy)))
- /.zip
+ /.zipper
(do> maybe.monad
[/.down]
[(/.insert_left expected)]
diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux
index 7223497d1..f39c25c01 100644
--- a/stdlib/source/test/lux/data/text.lux
+++ b/stdlib/source/test/lux/data/text.lux
@@ -65,15 +65,15 @@
[/.prefix /.starts_with?]
[/.suffix /.ends_with?]
- [/.enclose' /.encloses?]
+ [/.enclosed' /.enclosed_by?]
))
- (_.cover [/.enclose]
- (let [value (/.enclose [left right] inner)]
+ (_.cover [/.enclosed]
+ (let [value (/.enclosed [left right] inner)]
(and (/.starts_with? left value)
(/.ends_with? right value))))
(_.cover [/.format]
(let [sample (/.format inner)]
- (and (/.encloses? /.double_quote sample)
+ (and (/.enclosed_by? /.double_quote sample)
(/.contains? inner sample))))
))))
diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux
index 638afd90f..a7741082a 100644
--- a/stdlib/source/test/lux/debug.lux
+++ b/stdlib/source/test/lux/debug.lux
@@ -210,13 +210,13 @@
(: (List Any))
(list\map /.inspection)
(text.join_with " ")
- (text.enclose ["[" "]"]))
+ (text.enclosed ["[" "]"]))
(/.inspection [sample_bit sample_int sample_frac sample_text]))
)))))
(syntax: (macro_error macro)
(function (_ compiler)
- (case ((macro.expand macro) compiler)
+ (case ((macro.expansion macro) compiler)
(#try.Failure error)
(#try.Success [compiler (list (code.text error))])
diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux
index 4eb815ff7..b5d9fffbf 100644
--- a/stdlib/source/test/lux/ffi.jvm.lux
+++ b/stdlib/source/test/lux/ffi.jvm.lux
@@ -56,7 +56,7 @@
(syntax: (macro_error expression)
(function (_ lux)
- (|> (macro.expand_once expression)
+ (|> (macro.single_expansion expression)
(meta.run lux)
(case> (#try.Success expansion)
(#try.Failure "OOPS!")
diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux
index 20db9b265..115b5168e 100644
--- a/stdlib/source/test/lux/macro.lux
+++ b/stdlib/source/test/lux/macro.lux
@@ -75,9 +75,9 @@
{#.module_hash 0
#.module_aliases (list)
#.definitions (: (List [Text .Global])
- (list (!global /.log_expand_once!)
- (!global /.log_expand!)
- (!global /.log_expand_all!)))
+ (list (!global /.log_single_expansion!)
+ (!global /.log_expansion!)
+ (!global /.log_full_expansion!)))
#.imports (list)
#.tags (list)
#.types (list)
@@ -113,11 +113,11 @@
pow/1 (\ ! map code.nat random.nat)
repetitions (\ ! map (nat.% 10) random.nat)
- #let [expand_once (` (..pow/2 (..pow/2 (~ pow/1))))
- expand (` (nat.* (..pow/2 (~ pow/1))
+ #let [single_expansion (` (..pow/2 (..pow/2 (~ pow/1))))
+ expansion (` (nat.* (..pow/2 (~ pow/1))
(..pow/2 (~ pow/1))))
- expand_all (` (nat.* (nat.* (~ pow/1) (~ pow/1))
- (nat.* (~ pow/1) (~ pow/1))))]]
+ full_expansion (` (nat.* (nat.* (~ pow/1) (~ pow/1))
+ (nat.* (~ pow/1) (~ pow/1))))]]
(`` ($_ _.and
(~~ (template [<expander> <logger> <expansion>]
[(_.cover [<expander>]
@@ -128,22 +128,22 @@
(try.default false)))
(_.cover [<logger>]
- (and (|> (/.expand_once (` (<logger> (~' #omit) (..pow/4 (~ pow/1)))))
+ (and (|> (/.single_expansion (` (<logger> (~' #omit) (..pow/4 (~ pow/1)))))
(meta.run lux)
(try\map (\ (list.equivalence code.equivalence) = (list)))
(try.default false))
- (|> (/.expand_once (` (<logger> (..pow/4 (~ pow/1)))))
+ (|> (/.single_expansion (` (<logger> (..pow/4 (~ pow/1)))))
(meta.run lux)
(try\map (\ (list.equivalence code.equivalence) = (list <expansion>)))
(try.default false))))]
- [/.expand_once /.log_expand_once! expand_once]
- [/.expand /.log_expand! expand]
- [/.expand_all /.log_expand_all! expand_all]
+ [/.single_expansion /.log_single_expansion! single_expansion]
+ [/.expansion /.log_expansion! expansion]
+ [/.full_expansion /.log_full_expansion! full_expansion]
))
- (_.cover [/.expand_1]
+ (_.cover [/.one_expansion]
(bit\= (not (nat.= 1 repetitions))
- (|> (/.expand_1 (` (..repeat (~ (code.nat repetitions)) (~ pow/1))))
+ (|> (/.one_expansion (` (..repeat (~ (code.nat repetitions)) (~ pow/1))))
(meta.run lux)
(!expect (#try.Failure _)))))
))))
@@ -163,10 +163,10 @@
(and (text.contains? gensym_prefix actual_gensym)
(text.contains? (%.nat seed) actual_gensym))))))
(_.cover [/.wrong_syntax_error]
- (|> (/.expand_once (` (/.log_expand_once!)))
+ (|> (/.single_expansion (` (/.log_single_expansion!)))
(meta.run lux)
(!expect (^multi (#try.Failure error)
- (text.contains? (/.wrong_syntax_error (name_of /.log_expand_once!))
+ (text.contains? (/.wrong_syntax_error (name_of /.log_single_expansion!))
error)))))
(_.cover [/.with_gensyms]
(with_expansions [<expected> (fresh_identifier)]
diff --git a/stdlib/source/test/lux/macro/local.lux b/stdlib/source/test/lux/macro/local.lux
index 37b718a8e..8b8a14790 100644
--- a/stdlib/source/test/lux/macro/local.lux
+++ b/stdlib/source/test/lux/macro/local.lux
@@ -29,7 +29,7 @@
(syntax: (macro_error macro)
(function (_ compiler)
- (case ((macro.expand macro) compiler)
+ (case ((macro.expansion macro) compiler)
(#try.Failure error)
(#try.Success [compiler (list (code.text error))])
@@ -61,7 +61,7 @@
(exec (~ pop!)
(~ g!output))))]
(if pre_remove
- (macro.expand_all pre_expansion)
+ (macro.full_expansion pre_expansion)
(in (list pre_expansion)))))))
(def: #export test
diff --git a/stdlib/source/test/lux/macro/template.lux b/stdlib/source/test/lux/macro/template.lux
index c46bb5b8c..ecec132d7 100644
--- a/stdlib/source/test/lux/macro/template.lux
+++ b/stdlib/source/test/lux/macro/template.lux
@@ -28,7 +28,7 @@
(syntax: (macro_error macro)
(function (_ compiler)
- (case ((macro.expand macro) compiler)
+ (case ((macro.expansion macro) compiler)
(#try.Failure error)
(#try.Success [compiler (list (code.text error))])
diff --git a/stdlib/source/test/lux/math/number/int.lux b/stdlib/source/test/lux/math/number/int.lux
index 99738824a..00b66d700 100644
--- a/stdlib/source/test/lux/math/number/int.lux
+++ b/stdlib/source/test/lux/math/number/int.lux
@@ -177,9 +177,11 @@
(and subtraction!
inverse!))))
(do {! random.monad}
- [expected (\ ! map (/.% +1,000,000) random.int)]
+ [expected (\ ! map (/.% +1,000,000) random.int)
+ sample random.int]
(_.cover [/.frac]
- (|> expected /.frac f.int (/.= expected))))
+ (and (|> expected /.frac f.int (/.= expected))
+ (f.number? (/.frac sample)))))
(do {! random.monad}
[pattern random.int
idx (\ ! map (n.% i64.width) random.nat)]
diff --git a/stdlib/source/test/lux/math/number/nat.lux b/stdlib/source/test/lux/math/number/nat.lux
index 3d553e167..05fbfb303 100644
--- a/stdlib/source/test/lux/math/number/nat.lux
+++ b/stdlib/source/test/lux/math/number/nat.lux
@@ -121,9 +121,11 @@
(/.= 0 (/.% right lcm)))))
))
(do {! random.monad}
- [expected (\ ! map (/.% 1,000,000) random.nat)]
+ [expected (\ ! map (/.% 1,000,000) random.nat)
+ sample random.nat]
(_.cover [/.frac]
- (|> expected /.frac f.nat (/.= expected))))
+ (and (|> expected /.frac f.nat (/.= expected))
+ (f.number? (/.frac sample)))))
..predicate
..signature
diff --git a/stdlib/source/test/lux/math/number/rev.lux b/stdlib/source/test/lux/math/number/rev.lux
index a302b2fc3..e99a1f656 100644
--- a/stdlib/source/test/lux/math/number/rev.lux
+++ b/stdlib/source/test/lux/math/number/rev.lux
@@ -156,9 +156,11 @@
(|> sample /.reciprocal .nat /.reciprocal .nat /.reciprocal))))
(do {! random.monad}
[expected (\ ! map (|>> f.abs (f.% +1.0))
- random.safe_frac)]
+ random.safe_frac)
+ sample random.rev]
(_.cover [/.frac]
- (|> expected f.rev /.frac (f.= expected))))
+ (and (|> expected f.rev /.frac (f.= expected))
+ (f.number? (/.frac sample)))))
..signature
))))
diff --git a/stdlib/source/test/lux/type/abstract.lux b/stdlib/source/test/lux/type/abstract.lux
index aaeb6f1b6..2b96f6788 100644
--- a/stdlib/source/test/lux/type/abstract.lux
+++ b/stdlib/source/test/lux/type/abstract.lux
@@ -34,7 +34,7 @@
(syntax: (with_no_active_frames macro)
(function (_ compiler)
- (let [verdict (case ((macro.expand macro) compiler)
+ (let [verdict (case ((macro.expansion macro) compiler)
(#try.Failure error)
(exception.match? /.no_active_frames error)
diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux
index 52c8fac88..ecfbe8aab 100644
--- a/stdlib/source/test/lux/type/refinement.lux
+++ b/stdlib/source/test/lux/type/refinement.lux
@@ -48,20 +48,20 @@
(maybe\map (|>> /.predicate (is? predicate)))
(maybe.default false)))
))
- (_.cover [/.un_refine]
+ (_.cover [/.value]
(|> (/.refinement predicate modulus)
- (maybe\map (|>> /.un_refine (n.= modulus)))
+ (maybe\map (|>> /.value (n.= modulus)))
(maybe.default false)))
(_.cover [/.lift]
(and (|> (/.refinement predicate modulus)
(maybe\map (/.lift (n.+ modulus)))
maybe\join
- (maybe\map (|>> /.un_refine (n.= (n.+ modulus modulus))))
+ (maybe\map (|>> /.value (n.= (n.+ modulus modulus))))
(maybe.default false))
(|> (/.refinement predicate modulus)
(maybe\map (/.lift (n.+ (inc modulus))))
maybe\join
- (maybe\map (|>> /.un_refine (n.= (n.+ modulus (inc modulus)))))
+ (maybe\map (|>> /.value (n.= (n.+ modulus (inc modulus)))))
(maybe.default false)
not)))
(_.cover [/.only]
@@ -71,7 +71,7 @@
(list.size actual))
(\ (list.equivalence n.equivalence) =
expected
- (list\map /.un_refine actual)))))
+ (list\map /.value actual)))))
(_.cover [/.partition]
(let [expected (list.only predicate raws)
[actual alternative] (/.partition (/.refinement predicate) raws)]
@@ -81,7 +81,7 @@
(list.size alternative))
(\ (list.equivalence n.equivalence) =
expected
- (list\map /.un_refine actual)))))
+ (list\map /.value actual)))))
(_.cover [/.type]
(exec (: (Maybe .._type)
(.._refiner raw))
diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux
index cd6f78096..f761a0f3f 100644
--- a/stdlib/source/test/lux/type/resource.lux
+++ b/stdlib/source/test/lux/type/resource.lux
@@ -153,7 +153,7 @@
[[_ _ _ exception] (meta.export exception)]
(function (_ compiler)
(#.Right [compiler
- (list (code.bit (case ((macro.expand_once to_expand) compiler)
+ (list (code.bit (case ((macro.single_expansion to_expand) compiler)
(#try.Success _)
false