mirror of
https://github.com/erg-lang/erg.git
synced 2025-12-23 05:36:48 +00:00
22 lines
596 B
Python
22 lines
596 B
Python
higher(f: (Nat -> Nat)): Nat = f(1)
|
|
_abs(x: Int): Nat = x.abs()
|
|
|
|
print! higher _abs # OK
|
|
|
|
higher2(f: ((g: Nat -> Nat) -> Nat)): Nat = f((x: Nat) -> x + 1)
|
|
f(g: Bool -> Nat): Nat = g(False)
|
|
|
|
print! higher2 f # OK
|
|
|
|
str_to_int_or_rec(_: {Str: Int or Record}) = None
|
|
|
|
str_to_int_or_rec { "a": 1 }
|
|
str_to_int_or_rec { "a": {.a = 1} }
|
|
str_to_int_or_rec { "a": {.a = 1}, "b": 1 }
|
|
|
|
_ as List(List(Int)) = ![![1]]
|
|
_ as List(List(Int, 1), 1) = ![![1]]
|
|
_ as List(List!(Int, 1), 1) = ![![1]]
|
|
_ as List!(List(Int, 1), 1) = ![![1]]
|
|
_ as List!(List!(Int, 1), 1) = ![![1]]
|
|
_ as List!(List!({1}, 1), 1) = ![![1]]
|