par.run is warming up
Par
A programming language experiment with linear types, duality, and concurrency at its core.
This is the first scaffold of the Par website. The language, docs, playground, and standard library pages are coming together here, but the final story is still being written.
Playground.par WIP
module Playground
import {
@core/Int
@core/Nat
}
def Describe = [number: Int] if {
number < 0 => "Negative",
number == 0 => "Zero",
0 < number < 100 => "Small",
else => "Incomprehensible",
}
dec Factorial : [Nat] Nat
def Factorial = [n]
Nat.Range(1, n).begin.case {
.end! => 1,
.item(x) xs => x * xs.loop,
}
dec Fibonacci : iterative choice {
.next => (Nat) self,
.close => !,
}
def Fibonacci = do {
let a = 0
let b = 1
} in begin case {
.next => do {
let (a, b)! = (b, a + b)!
} in (a) loop,
.close => !,
}