feat: add Predicate::General{Less, Greater, Not}Equal

This commit is contained in:
Shunsuke Shibayama 2024-01-28 20:24:14 +09:00
parent 8350ad0581
commit 06a4a6e5fc
10 changed files with 304 additions and 18 deletions

View file

@ -49,3 +49,10 @@
assert [1, 2, 3].product() == 6
'''
prod: |T: Type|(self: Array(T, _), start := T) -> T
'''
Returns the reversed array.
'''
'''erg
assert [1, 2, 3].reversed() == [3, 2, 1]
'''
reversed: |T: Type, N: Nat|(self: Array(T, N)) -> Array(T, N)

View file

@ -111,6 +111,9 @@ class Array(list):
from functools import reduce
return reduce(lambda x, y: x * y, self, start)
def reversed(self):
return Array(list.__reversed__(self))
class UnsizedArray:
elem: object
def __init__(self, elem):