Your Docusaurus site did not load properly.

A very common reason is a wrong site baseUrl configuration.

Current configured baseUrl = / (default value)

We suggest trying baseUrl =

samlang

Sam's Programming Language

Hello World

class Main {
function main(): string = "Hello World"
}

42

class Main {
function main(): int = 2 * 21
}

Pattern Matching

class Option<T>(None(unit), Some(T)) {
function <T> getNone(): Option<T> = None(unit)
function <T> getSome(d: T): Option<T> = Some(d)
method <R> map(f: (T) -> R): Option<R> =
match (this) {
| None _ -> None(unit)
| Some d -> Some(f(d))
}
}

Type Inference

class TypeInference {
function notAnnotated(): unit = {
val _ = (a, b, c) -> if a(b + 1) then b else c;
}
// Read the docs to see how we do the type inference.
function annotated(): unit = {
val _: ((int) -> bool, int, int) -> int =
(a: (int) -> bool, b: int, c: int) -> (
if a(b + 1) then b else c
);
}
}