mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-03 18:29:00 +00:00
40 lines
641 B
Python
40 lines
641 B
Python
id x = x
|
|
id2 = x -> x
|
|
|
|
if__ cond, then, else = if cond, then, else
|
|
|
|
for__! i, proc! = for! i, proc!
|
|
|
|
add x, y = x + y
|
|
add2 = (x, y) -> x + y
|
|
|
|
abs_ x = x.abs()
|
|
abs2 = x -> x.abs()
|
|
|
|
Norm = Trait { .norm = (self: Self) -> Nat }
|
|
norm x = x.norm()
|
|
|
|
a = [1, 2] + [3, 4]
|
|
|
|
abc = ["c"] + ["a", "b"][1..1000]
|
|
|
|
f! t =
|
|
arr = ![]
|
|
result = ![]
|
|
result.push! t
|
|
for! arr, t =>
|
|
result.extend! f! t
|
|
result
|
|
|
|
c_new x, y = C.new x, y
|
|
C = Class Int
|
|
C.
|
|
new x, y = Self x + y
|
|
|
|
val!() =
|
|
for! [{ "a": "b" }], (pkg as {Str: Str}) =>
|
|
x = pkg.get("a", "c")
|
|
assert x in {"b"}
|
|
val!::return x
|
|
"d"
|
|
val = val!()
|