tomo/test/reductions.tm

19 lines
354 B
Plaintext
Raw Normal View History

2024-04-12 10:09:31 -07:00
struct Foo(x,y:Int)
2024-03-07 09:18:01 -08:00
2024-04-28 11:58:55 -07:00
func main():
2024-04-12 10:09:31 -07:00
>> (+) [10, 20, 30]
= 60
2024-03-07 09:18:01 -08:00
2024-04-12 10:09:31 -07:00
>> (_max_) [3, 5, 2, 1, 4]
= 5
2024-03-07 09:18:01 -08:00
2024-04-12 10:09:31 -07:00
>> (_max_:abs()) [1, -10, 5]
= -10
>> (_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)