mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 02:39:20 +00:00
feat: add Predicate::General{Less, Greater, Not}Equal
This commit is contained in:
parent
8350ad0581
commit
06a4a6e5fc
10 changed files with 304 additions and 18 deletions
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue