From 4bf3b26d3bea2fe85e858e7992042e743eb34f70 Mon Sep 17 00:00:00 2001 From: crc Date: Thu, 20 Feb 2020 20:48:29 +0000 Subject: [PATCH] examples: rename a word to make an example a little clearer FossilOrigin-Name: 4b087b4d34742d0fed2348cebe215d8d4ae16c3edccf8b5a862c66d33cc291f2 --- example/local-variables.retro | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/example/local-variables.retro b/example/local-variables.retro index e30485a..700d0dd 100644 --- a/example/local-variables.retro +++ b/example/local-variables.retro @@ -7,14 +7,14 @@ combinator, but this can lead to ugly code. Consider: 'Counter var - :test (...n-v) + :average (...n-v) &Counter [ #0 !Counter [ + &Counter v:inc ] times @Counter / ] v:preserve ; :run-tests #0 !Counter - #1 #2 #3 #4 #3 test n:put nl &Counter v:inc - #10 #20 #30 #40 #3 test n:put nl &Counter v:inc - #11 #21 #31 #41 #3 test n:put nl &Counter v:inc + #1 #2 #3 #4 #3 average n:put nl &Counter v:inc + #10 #20 #30 #40 #3 average n:put nl &Counter v:inc + #11 #21 #31 #41 #3 average n:put nl &Counter v:inc @Counter n:put sp '_tests_finished s:put nl ; run-tests @@ -23,13 +23,13 @@ The code implemented here allows for wrapping the most recent word within a `v:preserve` clause, letting the above definition of `test` become: - :test (...n-v) + :average (...n-v) #0 !Counter [ + &Counter v:inc ] times @Counter / ; &Counter make-local And if you need multiple variables to be localized: - :test ... ; + :average ... ; { &Array &Of &Variables } locals # The Code