The Crow Programming Language

Importing with use

use brings a standard-library module's vocabulary into your file, bare:

1
2
3
4
5
6
7
use math

xs = [3.0, 1.0, 4.0, 1.0, 5.0]
log[sum[xs]]
log[mean[xs]]
log[math.sum[xs]]
log[pi]

expected output — from the book, verified by crow test --book

14
2.8
14
3.141592653589793

After use math, its functions (sum, mean, std, zeros, matmul, …) and constants (pi, e, inf, nan) work without a prefix — and the prefixed form math.sum[...] always works too, if you prefer to read the source of a name at its callsite.

Import several modules in one line: use web, ui. Submodules opt in separately: use math.stats adds median and friends without bloating plain use math.

The standard modules are math (+ .stats, .nn), frame, io, db, web (+ feature submodules), and ui. Only these get the bare-name privilege — everything else you import lives behind a prefix, as you'll see in the last section.