Where next
You know the language now. Most of what you write from here calls the standard library: a set of namespaces such as Array, String, Time, and Json, always there, with no import.
type Visit = { user: string, day: Time.PlainDate }
let log = `ann,2026-11-02
bob,2026-11-02
ann,2026-11-05
cid,2026-11-07`
// Csv splits the text into rows, Time reads the dates.
let rows = Csv.parse(log).unwrap()
let visits = rows.map({ Visit{ user: x[0], day: Time.parsePlainDate(x[1]).unwrap() } })
// Array groups the visits, Map counts each group, Json writes the counts.
let byUser = visits.groupBy({ x.user })
let counts = byUser.map({ x.value.length() })
println(Json.stringify(counts, indent: " "))
// Time measures the span from the first visit to the last.
let first = visits[0].day
let last = visits[visits.length() - 1].day
println("${first} to ${last}: ${first.until(last)}")
// String joins and formats the names.
println(byUser.keys().sort() | String.join(", ") | String.toUpper()){
"ann": 2,
"bob": 1,
"cid": 1
}
2026-11-02 to 2026-11-07: P5D
ANN, BOB, CIDSix namespaces, and every call has the shape you met in the tour: the subject goes first, so | reaches each function, and . reaches the functions of the subject's own type. visits.groupBy(...) is Array.groupBy, byUser.map(...) is Map.map, and first.until(last) is Time.until. An array's . reaches Array, so String.join takes the names through |. The other calls are Csv.parse, Time.parsePlainDate, Json.stringify, and String.join.
Look a name up
ant doc prints the signature and doc comment of any name in the standard library, the same text your editor shows on hover:
ant doc Array.groupByfunc Array.groupBy[T, K](xs: Array[T], key: func(T): K): Map[K, Array[T]]
Array.groupBy returns a map from each key to the elements of xs with that key. Keys are in
first-seen order and each group keeps the order of xs.
Array.groupBy([1, 2, 3, 4, 5], { x % 2 }) // Map{ 1: [1, 3, 5], 0: [2, 4] }A namespace alone, such as ant doc Csv, prints its doc and the signature of everything in it. Give ant doc a file, as in ant doc geo.ant, and it documents your own module the same way.
Try it
- Run
ant doc Mapand find a function that keeps only the users with more than one visit. - Print the day of the week of each visit with
Time.dayOfWeek. - Write the counts back out as CSV with
Csv.stringify.
Where to go
- Language guide: one chapter per area, such as errors, concurrency, and modules, with when to pick what.
- How-to guides: one task per page, such as running a program or streaming a command's output.
- Standard library: a page for every function and type, and topic guides such as text, files, and time.
- Language reference: every keyword, operator, literal, and built-in type.
- Coming from JavaScript, Go, or Python: the equivalents, and the differences that bite.
- Design notes: why Ant is the way it is, one decision per page.
The tools come in the same binary as ant run: ant check, ant fmt, ant test, ant doc, and ant code, which finds and renames names from a terminal. The plugins for VS Code, IntelliJ IDEA, and Neovim connect your editor to the language server, ant lsp, and the debugger, ant dap.
