aboutsummaryrefslogtreecommitdiff
path: root/test/reductions.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-07 12:18:01 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-07 12:18:01 -0500
commit6583221c0b46dd638e61a7b055c1b51922f38e7b (patch)
treeadc2029eb7ceb23609e5b834bd5d4d7b601864f4 /test/reductions.tm
parentfa66053e13c39e6f6a25db8f46b1e1f97ecce2fc (diff)
More tests
Diffstat (limited to 'test/reductions.tm')
-rw-r--r--test/reductions.tm16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/reductions.tm b/test/reductions.tm
new file mode 100644
index 00000000..e6b78539
--- /dev/null
+++ b/test/reductions.tm
@@ -0,0 +1,16 @@
+>> (+) [10, 20, 30]
+= 60
+
+>> (_max_) [3, 5, 2, 1, 4]
+= 5
+
+>> (_max_:abs()) [1, -10, 5]
+= -10
+
+struct Foo(x,y:Int)
+>> (_max_) [Foo(0, 0), Foo(1, 0), Foo(0, 10)]
+= Foo(x=1, y=0)
+>> (_max_.y) [Foo(0, 0), Foo(1, 0), Foo(0, 10)]
+= Foo(x=0, y=10)
+>> (_max_.y:abs()) [Foo(0, 0), Foo(1, 0), Foo(0, 10), Foo(0, -999)]
+= Foo(x=0, y=-999)