diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-08-29 15:59:30 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-08-29 16:00:04 -0700 |
| commit | 811fdd685670d2eb8c6bcb9e6e103e57bf402ca8 (patch) | |
| tree | c599fd7a609159c2ec50a30f1131000070e8eb03 /core/control_flow.nom | |
| parent | 22495c7d708b4950b83c5bc9b97806e19cd1fcfa (diff) | |
Tweaked version 3.6 to include deprecating list append/removal functions
in favor of using a method call style.
Diffstat (limited to 'core/control_flow.nom')
| -rw-r--r-- | core/control_flow.nom | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/control_flow.nom b/core/control_flow.nom index 95b9bcb..63601f7 100644 --- a/core/control_flow.nom +++ b/core/control_flow.nom @@ -172,19 +172,19 @@ compile [===next %var ===, ---next %var ---, ***next %var ***] to (..) test: %nums = [] - for %x in 1 to 5: add %x to %nums + for %x in 1 to 5: %nums::add %x assume (%nums == [1, 2, 3, 4, 5]) %nums = [] - for %x in 1 to 5 via 2: add %x to %nums + for %x in 1 to 5 via 2: %nums::add %x assume (%nums == [1, 3, 5]) %nums = [] for %outer in 1 to 100: for %inner in %outer to (%outer + 2): if (%inner == 2): - add -2 to %nums + %nums::add -2 do next %inner - add %inner to %nums + %nums::add %inner if (%inner == 5): stop %outer assume (%nums == [1, -2, 3, -2, 3, 4, 3, 4, 5]) @@ -227,13 +227,13 @@ parse [for %var in %start to %stop %body] as (..) test: %a = [10, 20, 30, 40, 50] %b = [] - for %x in %a: add %x to %b + for %x in %a: %b::add %x assume (%a == %b) %b = [] for %x in %a: if (%x == 10): do next %x if (%x == 50): stop %x - add %x to %b + %b::add %x assume (%b == [20, 30, 40]) @@ -268,7 +268,7 @@ test: for %k = %v in %d: if (%k == "a"): do next %k if (%v == 20): do next %v - add "\%k = \%v" to %result + %result::add "\%k = \%v" assume ((%result sorted) == ["c = 30", "d = 40", "e = 50"]) @@ -486,7 +486,7 @@ test: for % in recursive %t: if ((type of %) is "table"): for %2 in %: recurse % on %2 - ..else: add % to %flat + ..else: %flat::add % assume ((sorted %flat) == [1, 2, 3, 4, 5, 6]) |
