From 811fdd685670d2eb8c6bcb9e6e103e57bf402ca8 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 29 Aug 2018 15:59:30 -0700 Subject: Tweaked version 3.6 to include deprecating list append/removal functions in favor of using a method call style. --- core/control_flow.nom | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'core/control_flow.nom') 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]) -- cgit v1.2.3