mirror of
https://github.com/erg-lang/erg.git
synced 2025-07-07 21:25:31 +00:00
11 lines
302 B
Python
11 lines
302 B
Python
IntList = Class NoneType or { .node = Int; .next = IntList }
|
|
IntList.
|
|
null = IntList None
|
|
insert self, node = IntList { .node; .next = self }
|
|
fst self =
|
|
match self::base:
|
|
{ node; next = _ } => node
|
|
None => None
|
|
|
|
l = IntList.null.insert 1
|
|
assert l.fst() == 1
|