diff options
author | Eduardo Julian | 2022-03-30 14:05:57 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-03-30 14:05:57 -0400 |
commit | 381ec5920d9ebeb335963778dec182268819e718 (patch) | |
tree | 5c9288c5fbb16c21a0f00f96710b0aa7db4585f4 /stdlib/source/documentation | |
parent | 1a962ee4b03f51f46a5979bfefc954f35ee3a1b7 (diff) |
Now demanding mandatory loop names, instead of using default "again" name.
Diffstat (limited to 'stdlib/source/documentation')
-rw-r--r-- | stdlib/source/documentation/lux.lux | 13 | ||||
-rw-r--r-- | stdlib/source/documentation/lux/control/pipe.lux | 12 |
2 files changed, 12 insertions, 13 deletions
diff --git a/stdlib/source/documentation/lux.lux b/stdlib/source/documentation/lux.lux index be907a73d..5dbef4fac 100644 --- a/stdlib/source/documentation/lux.lux +++ b/stdlib/source/documentation/lux.lux @@ -535,8 +535,8 @@ [(def: .public (range enum from to) (All (_ a) (-> (Enum a) a a (List a))) (let [(open "[0]") enum] - (loop [end to - output {.#End}] + (loop (again [end to + output {.#End}]) (cond (< end from) (again (pred end) {.#Item end output}) @@ -679,15 +679,14 @@ (documentation: /.loop (format "Allows arbitrary looping, using the 'again' form to re-start the loop." \n "Can be used in monadic code to create monadic loops.") - [(loop [count +0 - x init] + [(loop (again [count +0 + x init]) (if (< +10 count) (again (++ count) (f x)) x))] ["Loops can also be given custom names." - (loop my_loop - [count +0 - x init] + (loop (my_loop [count +0 + x init]) (if (< +10 count) (my_loop (++ count) (f x)) x))]) diff --git a/stdlib/source/documentation/lux/control/pipe.lux b/stdlib/source/documentation/lux/control/pipe.lux index 4326a6d49..ae6c1e740 100644 --- a/stdlib/source/documentation/lux/control/pipe.lux +++ b/stdlib/source/documentation/lux/control/pipe.lux @@ -1,6 +1,6 @@ (.using [library - [lux {"-" let cond if loop exec case} + [lux {"-" let cond if exec case} ["$" documentation {"+" documentation:}] [data [text {"+" \n} @@ -51,12 +51,12 @@ (when [n.even?] [(n.* 2)])))]) -(documentation: /.loop - (format "Loops for pipes." +(documentation: /.while + (format "While loops for pipes." \n "Both the testing and calculating steps are pipes and must be given inside tuples.") [(|> +1 - (loop [(i.< +10)] - [++]))]) + (while [(i.< +10)] + [++]))]) (documentation: /.do (format "Monadic pipes." @@ -110,7 +110,7 @@ ..cond ..if ..when - ..loop + ..while ..do ..exec ..tuple |