From 63dec2e80905100ae2b48ada1d4e0d675338d00f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 13 Jun 2022 07:40:50 -0400 Subject: De-sigil-ification: suffix : [Part 7] --- .../documentation/lux/control/concatenative.lux | 88 +++++++++------------- 1 file changed, 36 insertions(+), 52 deletions(-) (limited to 'stdlib/source/documentation') diff --git a/stdlib/source/documentation/lux/control/concatenative.lux b/stdlib/source/documentation/lux/control/concatenative.lux index 6b71f6ecd..7fa084004 100644 --- a/stdlib/source/documentation/lux/control/concatenative.lux +++ b/stdlib/source/documentation/lux/control/concatenative.lux @@ -1,6 +1,6 @@ (.using [library - [lux (.except if loop) + [lux (.except if loop left right) ["$" documentation (.only documentation:)] [data [text @@ -30,22 +30,6 @@ else (=> ,,,0 ,,,1)] ,,,0 [Bit then else] ,,,1))]) -(documentation: /.||> - "A self-contained sequence of concatenative instructions." - [(same? value - (||> (push sample)))] - [(||> (push 123) - dup - n/=)]) - -(documentation: /.word: - "A named concatenative function." - [(word: square - (=> [Nat] [Nat]) - - dup - (apply_2 n.*))]) - (documentation: /.apply "A generator for functions that turn arity N functions into arity N concatenative functions." [(is (=> [Nat] [Nat]) @@ -77,19 +61,19 @@ (documentation: /.swap "Swaps the 2 topmost stack values.") -(documentation: /.rotL +(documentation: /.left_rotation "Rotes the 3 topmost stack values to the left.") -(documentation: /.rotR +(documentation: /.right_rotation "Rotes the 3 topmost stack values to the right.") (documentation: /.&& "Groups the 2 topmost stack values as a 2-tuple.") -(documentation: /.||L +(documentation: /.left "Left-injects the top into sum.") -(documentation: /.||R +(documentation: /.right "Right-injects the top into sum.") (with_template [ ] @@ -144,10 +128,10 @@ (documentation: /.if "If expression." [(same? "then" - (||> (push true) - (push "then") - (push "else") - if))]) + (/.value (|>> (push true) + (push "then") + (push "else") + if)))]) (documentation: /.call "Executes an anonymous block on the stack.") @@ -164,38 +148,38 @@ (documentation: /.do "Do-while loop expression." [(n.= (++ sample) - (||> (push sample) - (push (push false)) - (push (|>> (push 1) n/+)) - do while))]) + (/.value (|>> (push sample) + (push (push false)) + (push (|>> (push 1) n/+)) + do while)))]) (documentation: /.while "While loop expression." [(n.= (n.+ distance start) - (||> (push start) - (push (|>> dup - (push start) n/- - (push distance) n/<)) - (push (|>> (push 1) n/+)) - while))]) + (/.value (|>> (push start) + (push (|>> dup + (push start) n/- + (push distance) n/<)) + (push (|>> (push 1) n/+)) + while)))]) (documentation: /.compose "Function composition." [(n.= (n.+ 2 sample) - (||> (push sample) - (push (|>> (push 1) n/+)) - (push (|>> (push 1) n/+)) - compose - call))]) + (/.value (|>> (push sample) + (push (|>> (push 1) n/+)) + (push (|>> (push 1) n/+)) + compose + call)))]) (documentation: /.partial "Partial application." [(n.= (n.+ sample sample) - (||> (push sample) - (push sample) - (push n/+) - partial - call))]) + (/.value (|>> (push sample) + (push sample) + (push n/+) + partial + call)))]) (documentation: /.when "Only execute the block when #1.") @@ -208,8 +192,6 @@ ($.module /._ "" [..=> - ..||> - ..word: ..apply ..apply_1 ..apply_2 @@ -224,11 +206,11 @@ ..nip ..dup ..swap - ..rotL - ..rotR + ..left_rotation + ..right_rotation ..&& - ..||L - ..||R + ..left + ..right ..if ..call ..loop @@ -280,5 +262,7 @@ ..f/< ..f/<= ..f/> - ..f/>=] + ..f/>= + + ($.default /.value)] [])) -- cgit v1.2.3