plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


examples/closures.plum
0fe3528 1
fun each(cb: fn(Int) -> Int) -> Int =
6341c74 2
  cb(5)
6341c74 3
0fe3528 4
fun useCapturingClosure() -> Int =
0000000 5
  offset := 100
0000000 6
  cb := |v|
6341c74 7
    v + offset
6341c74 8
  cb(5)
6341c74 9
0fe3528 10
fun main() -> Int =
6341c74 11
  each(|v| v * 3) + useCapturingClosure()