mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 12:51:10 +00:00
Add collections
module
This commit is contained in:
parent
157c0cb7a5
commit
7b16e413f7
2 changed files with 24 additions and 0 deletions
11
compiler/erg_compiler/lib/pystd/collections.d/__init__.d.er
Normal file
11
compiler/erg_compiler/lib/pystd/collections.d/__init__.d.er
Normal file
|
@ -0,0 +1,11 @@
|
|||
.abc = pyimport "abc"
|
||||
|
||||
.NamedTuple = 'namedtuple': ClassType
|
||||
.Deque = 'deque': ClassType
|
||||
.ChainMap: ClassType
|
||||
.Counter: ClassType
|
||||
.OrderedDict: ClassType
|
||||
.Defaultdict = 'defaultDict': ClassType
|
||||
.UserDict: ClassType
|
||||
.UserList: ClassType
|
||||
.UserString: ClassType
|
13
compiler/erg_compiler/lib/pystd/collections.d/abc.d.er
Normal file
13
compiler/erg_compiler/lib/pystd/collections.d/abc.d.er
Normal file
|
@ -0,0 +1,13 @@
|
|||
.Container = Trait { .__contains__ = (self: Self) -> Bool }
|
||||
.Hashable = Trait { .__hash__ = (self: Self) -> Nat }
|
||||
.Sized = Trait { .__len__ = (self: Self) -> Nat }
|
||||
# TODO: varargs
|
||||
.Callable = Trait { .__call__ = (self: Self) -> Obj }
|
||||
# .Iterable T = Trait { .__iter__ = (self: Self) -> Iterator T }
|
||||
.Iterable = Trait { .__iter__ = (self: Self) -> .Iterator }
|
||||
.Collection = Subsume .Container and .Iterable
|
||||
# .Iterator T = Trait { .__next__ = (self: Self) -> T }
|
||||
.Iterator = Trait { .__next__ = (self: Self) -> Obj }
|
||||
.Reversible = Trait { .__reversed__ = (self: Self) -> .Iterator }
|
||||
.Genertor = Subsume .Iterator
|
||||
.Sequence = Subsume .Collection and .Sized and .Reversible
|
Loading…
Add table
Add a link
Reference in a new issue