POLYTONE — the AI-native programming language

Guide

Collections

Lists, maps, sets, and tuples are built-in literals with value semantics: assignment copies, so data never changes behind your back.

collections.pt
fn main() -> Void:
    let scores = [72, 45, 91, 60]
    let passed = scores.filter(fn(s: Int) -> Bool = s >= 50)
    let average = scores.fold(0, fn(a: Int, s: Int) -> Int = a + s) / scores.len()
    print("passed: {passed}")
    print("average: {average}")

    let ages = {"Ada": 36, "Bob": 27}
    match ages.get("Ada"):
        case Some(age):
            print("Ada is {age}")
        case None:
            print("Ada is unknown")

m[key] on a missing key is a runtime error; m.get(key) returns Option[V] for the safe path. The same pattern repeats across the language: the concise form exists, and the total form is one method away.