plum

#treesitter#compiler#wasm

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

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


plum-examples/testing.plum
b7071c9 1
import std/Str
73b5e55 2
import std/Bool
ca5fd6f 3
import std/Number
b7071c9 4
a271f34 5
fun add(a: Int, b: Int) -> Int =
a271f34 6
  a + b
a271f34 7
a271f34 8
fun isEven(n: Int) -> Bool =
a271f34 9
  n % 2 == 0
a271f34 10
a271f34 11
test "add works"
9682cec 12
  assert add(1, 2) == 3
a9a0147 13
  assert add(2, 2) == 4
a271f34 14
a271f34 15
test "isEven works"
a9a0147 16
  assert isEven(4)
a9a0147 17
  assert !isEven(3)
a271f34 18
  assert isEven(2)