aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/documentation
diff options
context:
space:
mode:
authorEduardo Julian2022-03-14 18:27:37 -0400
committerEduardo Julian2022-03-14 18:27:37 -0400
commit41495e32d3f5f88b5f189f48dd4fdbfa883c6ac0 (patch)
tree7a561e83768d5ac4eb08855858dde38d2987fc46 /stdlib/source/documentation
parent62299ecdc93b39f6a22b1f89779f55dfa735fb3c (diff)
De-sigil-ification: >
Diffstat (limited to 'stdlib/source/documentation')
-rw-r--r--stdlib/source/documentation/lux/control/pipe.lux123
1 files changed, 62 insertions, 61 deletions
diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux
index 330370e9f..4326a6d49 100644
--- a/stdlib/source/documentation/lux/control/pipe.lux
+++ b/stdlib/source/documentation/lux/control/pipe.lux
@@ -1,117 +1,118 @@
(.using
- [library
- [lux {"-" if loop}
- ["$" documentation {"+" documentation:}]
- [data
- [text {"+" \n}
- ["%" format {"+" format}]]]
- [macro
- ["[0]" template]]]]
- [\\library
- ["[0]" /]])
+ [library
+ [lux {"-" let cond if loop exec case}
+ ["$" documentation {"+" documentation:}]
+ [data
+ [text {"+" \n}
+ ["%" format {"+" format}]]]
+ [macro
+ ["[0]" template]]]]
+ [\\library
+ ["[0]" /]])
-(documentation: /.new>
+(documentation: /.new
"Ignores the piped argument, and begins a new pipe."
[(n.= 1
(|> 20
(n.* 3)
(n.+ 4)
- (new> 0 [++])))])
+ (new 0 [++])))])
-(documentation: /.let>
+(documentation: /.let
"Gives a name to the piped-argument, within the given expression."
[(n.= 10
(|> 5
- (let> x (n.+ x x))))])
+ (let x (n.+ x x))))])
-(documentation: /.cond>
+(documentation: /.cond
(format "Branching for pipes."
\n "Both the tests and the bodies are piped-code, and must be given inside a tuple.")
[(|> +5
- (cond> [i.even?] [(i.* +2)]
- [i.odd?] [(i.* +3)]
- [(new> -1 [])]))])
+ (cond [i.even?] [(i.* +2)]
+ [i.odd?] [(i.* +3)]
+ [(new -1 [])]))])
-(documentation: /.if>
+(documentation: /.if
"If-branching."
[(same? (if (n.even? sample)
"even"
"odd")
(|> sample
- (if> [n.even?]
- [(new> "even" [])]
- [(new> "odd" [])])))])
+ (if [n.even?]
+ [(new "even" [])]
+ [(new "odd" [])])))])
-(documentation: /.when>
+(documentation: /.when
"Only execute the body when the test passes."
[(same? (if (n.even? sample)
(n.* 2 sample)
sample)
(|> sample
- (when> [n.even?]
- [(n.* 2)])))])
+ (when [n.even?]
+ [(n.* 2)])))])
-(documentation: /.loop>
+(documentation: /.loop
(format "Loops for pipes."
\n "Both the testing and calculating steps are pipes and must be given inside tuples.")
[(|> +1
- (loop> [(i.< +10)]
- [++]))])
+ (loop [(i.< +10)]
+ [++]))])
-(documentation: /.do>
+(documentation: /.do
(format "Monadic pipes."
\n "Each steps in the monadic computation is a pipe and must be given inside a tuple.")
[(|> +5
- (do> identity.monad
- [(i.* +3)]
- [(i.+ +4)]
- [++]))])
+ (do identity.monad
+ [(i.* +3)]
+ [(i.+ +4)]
+ [++]))])
-(documentation: /.exec>
+(documentation: /.exec
(format "Non-updating pipes."
\n "Will generate piped computations, but their results will not be used in the larger scope.")
[(|> +5
- (exec> [.nat %n log!])
+ (exec [.nat %n log!])
(i.* +10))])
-(documentation: /.tuple>
+(documentation: /.tuple
(format "Parallel branching for pipes."
\n "Allows to run multiple pipelines for a value and gives you a tuple of the outputs.")
[(|> +5
- (tuple> [(i.* +10)]
- [-- (i./ +2)]
- [i#encoded]))
+ (tuple [(i.* +10)]
+ [-- (i./ +2)]
+ [i#encoded]))
"=>"
[+50 +2 "+5"]])
-(documentation: /.case>
+(documentation: /.case
(format "Pattern-matching for pipes."
\n "The bodies of each branch are NOT pipes; just regular values.")
[(|> +5
- (case> +0 "zero"
- +1 "one"
- +2 "two"
- +3 "three"
- +4 "four"
- +5 "five"
- +6 "six"
- +7 "seven"
- +8 "eight"
- +9 "nine"
- _ "???"))])
+ (case
+ +0 "zero"
+ +1 "one"
+ +2 "two"
+ +3 "three"
+ +4 "four"
+ +5 "five"
+ +6 "six"
+ +7 "seven"
+ +8 "eight"
+ +9 "nine"
+ _ "???"))])
(.def: .public documentation
(.List $.Module)
($.module /._
"Composable extensions to the piping macros (|> and <|) that enhance them with various abilities."
- [..new>
- ..let>
- ..cond>
- ..if>
- ..when>
- ..loop>
- ..do>
- ..exec>
- ..tuple>
- ..case>]
+ [..new
+ ..let
+ ..cond
+ ..if
+ ..when
+ ..loop
+ ..do
+ ..exec
+ ..tuple
+ ..case]
[]))