diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 22:28:04 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-18 22:28:04 -0400 |
| commit | 7472837ee5a00bd9313e82f71f55b6f76ee7083b (patch) | |
| tree | 57b9b9f5823f2b58fbcf6e25901bc307e0df27fa /test | |
| parent | 19c51194f0b2ad945bfb7b544032210274b431dd (diff) | |
Add array:first(predicate:func(x:&T)->Bool)->@%T?
Diffstat (limited to 'test')
| -rw-r--r-- | test/arrays.tm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/arrays.tm b/test/arrays.tm index ac243018..c693996e 100644 --- a/test/arrays.tm +++ b/test/arrays.tm @@ -158,3 +158,14 @@ func main(): >> nums:sort(func(a,b:&%Int): a:abs() <> b:abs()) >> [nums:binary_search(i, func(a,b:&Int): a:abs() <> b:abs()) for i in nums] = [1, 2, 3, 4, 5] + + >> [10, 20, 30]:find(20) + = 2 + >> [10, 20, 30]:find(999) + = 0 + + >> [10, 20]:first(func(i:&Int): i:is_prime()) + = !Int + >> [4, 5, 6]:first(func(i:&Int): i:is_prime()) + = @%5? + |
