Learning Plenty
Plenty combines Python-shaped syntax with explicit types, ownership, and native compilation. The examples are self-contained and teach implemented features.
Start with Setting up to install a release and put plenty
on your PATH. Then follow the ten core parts to build a small command-line tool:
- Your first program: compile, run, and check.
- Values, functions, and control flow: name values, choose types, define functions, and repeat work.
- Absence and failure: handle missing values and errors
with
Option,Result,match, and?. - Collections, ownership, and borrowing: keep groups of values, transfer ownership, copy, and borrow.
- Iteration and transformation: visit values, transform them, and produce them incrementally.
- Defining your own data: write records, methods, constructors, and enums.
- Heterogeneous collections: combine different kinds of values with enums and anonymous sums.
- Special-purpose data structures: choose columnar storage for calculations over selected fields.
- Organizing a program: split a program into modules and choose its public interfaces.
- Useful programs and resources: use command-line arguments, text, standard streams, and files in a complete application.
Then choose an optional path when your program needs it:
- Generic code and protocols reuse algorithms across different types.
- Functions as values introduce callbacks and captured state, then stored and consuming callbacks.
- Concurrent and parallel programs coordinate workers, communicate, stop work, and bound waiting.
- Working with C libraries call foreign code, own foreign resources, and export library interfaces. This path does not require concurrency.
The Reference describes detailed contracts and limits. Use the supplementary examples to look up collection methods, text operations, and advanced file usage.