From 0d36812c6af951a41caac77d5f312949f3bc521f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 21 Sep 2025 22:55:03 -0400 Subject: Deprecate binary ops (other than ++) for tables. Instead use proper methods: t.with(other), t.without(other), t.intersection(other), t.difference(other) --- test/tables.tm | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/tables.tm b/test/tables.tm index 7b1ac22c..2eb1409e 100644 --- a/test/tables.tm +++ b/test/tables.tm @@ -77,3 +77,13 @@ func main() assert counter.has("y") == no >> counter["y"] += 1 + + do + # Set operations + a := {"A":1, "B":2, "C":3} + b := {"B":2, "C":30, "D":40} + assert a.with(b) == {"A":1, "B":2, "C":30, "D":40} + assert a.with(b) == a ++ b + assert a.intersection(b) == {"B":2} + assert a.difference(b) == {"A":1, "D":40} + assert a.without(b) == {"A":1, "C":3} -- cgit v1.2.3