Skip to content
Plumlang

Standard library

The standard library

The modules built into plum: numbers, text, files, time, JSON, tasks, sockets and HTTP.

Modules are imported with seed (spec section 9.2):

seed math                  # math.sqrt(2.0)
seed math as m             # m.sqrt(2.0)
seed math { sqrt, PI }     # sqrt(PI)
Module Contents
math constants and functions on numbers, and random numbers
str the methods of strings, always available without seed
io standard input, output and error
os the program's arguments, the environment and running commands
time clocks, sleeping and dates
fs files and directories
json parse and produce JSON; Json values
Task and Channel waiting for tasks, channels between them (no seed)
net TCP and UDP sockets, DNS; Listener, Connection, UdpSocket
net.http an HTTP/1.1 server and client, written in Plumlang
hash cryptographic digests: SHA-256

plum stdlib lists every module's functions with their signatures, and plum stdlib math one module's. The reference table on each page is generated from the same list (make stdlib-doc), and make test fails if a page falls behind.

In signatures, num means an int or a float: a num result is an int when every num argument is an int. A parameter written with = default can be left out.

Errors that the functions throw are listed with each module.

To add a module, see writing a module.