# Ludus prelude documentation
These functions are available in every Ludus script.
The documentation for any function can be found within Ludus by passing the function to `doc!`, 
e.g., running `doc! (add)` will send the documentation for `add` to the console.

For more information on the syntax & semantics of the Ludus language, see [language.md](./language.md).

The prelude itself is just a Ludus file, which you can see at [prelude.ld](./prelude.ld).

## A few notes
**Naming conventions.** Functions whose name ends with a question mark, e.g., `eq?`, return booleans.
Functions whose name ends with an exclamation point, e.g., `make!`, change state in some way.
In other words, they _do things_ rather than _calculating values_. 
Functions whose name includes a slash either convert from one value to another, e.g. `deg/rad`,
or they are variations on a function, e.g. `div/0` as a variation on `div`.

**How entries are formatted.** Each entry has a brief (sometimes too brief!) description of what it does.
It is followed by the patterns for each of its function clauses.
This should be enough to indicate order of arguments, types, and so on.

**Patterns often, but do not always, indicate types.** Typed patterns are written as `foo as :bar`,
where the type is indicated by the keyword. 
Possible ludus types are: `:nil`, `:boolean`, `:number`, `:keyword` (atomic values);
`:string` (strings are their own beast); `:tuple` and `:list` (ordered collections), `:set`s, and `:dict`ionaries (the other collection types); `:pkg` (packages, which are quasi-collections); `:fn` (functions); and `:box`es.

**Conventional types.** Ludus has two types based on conventions.
* _Result tuples._ Results are a way of modeling the result of a calculation that might fail.
The two possible values are `(:ok, value)` and `(:err, msg)`.
`msg` is usually a string describing what went wrong.
To work with result tuples, see [`unwrap!`](#unwrap) and [`unwrap_or`](#unwrap_or).
That said, usually you work with these using pattern matching.

* _Vectors._ Vectors are 2-element tuples of x and y coordinates.
The origin is `(0, 0)`. 
Many math functions take vectors as well as numbers, e.g., `add` and `mult`.
You will see vectors indicated in patterns by an `(x, y)` tuple.
You can see what this looks like in the last clause of `add`: `((x1, y1), (x2, y2))`.

## Functions by topic
### Boolean
[and](#and)&nbsp;&nbsp;&nbsp; [bool](#bool)&nbsp;&nbsp;&nbsp; [bool?](#bool)&nbsp;&nbsp;&nbsp; [false?](#false)&nbsp;&nbsp;&nbsp; [not](#not)&nbsp;&nbsp;&nbsp; [or](#or)&nbsp;&nbsp;&nbsp; [true?](#true)

### Boxes and state
[box?](#box)&nbsp;&nbsp;&nbsp; [store!](#store)&nbsp;&nbsp;&nbsp; [unbox](#unbox)&nbsp;&nbsp;&nbsp; [update!](#update)

### Dicts
[any?](#any)&nbsp;&nbsp;&nbsp; [assoc](#assoc)&nbsp;&nbsp;&nbsp; [assoc?](#assoc)&nbsp;&nbsp;&nbsp; [coll?](#coll)&nbsp;&nbsp;&nbsp; [count](#count)&nbsp;&nbsp;&nbsp; [dict](#dict)&nbsp;&nbsp;&nbsp; [dict?](#dict)&nbsp;&nbsp;&nbsp; [diff](#diff)&nbsp;&nbsp;&nbsp; [dissoc](#dissoc)&nbsp;&nbsp;&nbsp; [empty?](#empty)&nbsp;&nbsp;&nbsp; [get](#get)&nbsp;&nbsp;&nbsp; [keys](#keys)&nbsp;&nbsp;&nbsp; [random](#random)&nbsp;&nbsp;&nbsp; [update](#update)&nbsp;&nbsp;&nbsp; [values](#values)

### Environment and i/o
[doc!](#doc)&nbsp;&nbsp;&nbsp; [print!](#print)&nbsp;&nbsp;&nbsp; [report!](#report)&nbsp;&nbsp;&nbsp; [state](#state)

### Errors
[assert!](#assert)

### Lists
[any?](#any)&nbsp;&nbsp;&nbsp; [append](#append)&nbsp;&nbsp;&nbsp; [at](#at)&nbsp;&nbsp;&nbsp; [butlast](#butlast)&nbsp;&nbsp;&nbsp; [coll?](#coll)&nbsp;&nbsp;&nbsp; [concat](#concat)&nbsp;&nbsp;&nbsp; [count](#count)&nbsp;&nbsp;&nbsp; [each!](#each)&nbsp;&nbsp;&nbsp; [empty?](#empty)&nbsp;&nbsp;&nbsp; [filter](#filter)&nbsp;&nbsp;&nbsp; [first](#first)&nbsp;&nbsp;&nbsp; [fold](#fold)&nbsp;&nbsp;&nbsp; [join](#join)&nbsp;&nbsp;&nbsp; [keep](#keep)&nbsp;&nbsp;&nbsp; [last](#last)&nbsp;&nbsp;&nbsp; [list](#list)&nbsp;&nbsp;&nbsp; [list?](#list)&nbsp;&nbsp;&nbsp; [map](#map)&nbsp;&nbsp;&nbsp; [ordered?](#ordered)&nbsp;&nbsp;&nbsp; [random](#random)&nbsp;&nbsp;&nbsp; [range](#range)&nbsp;&nbsp;&nbsp; [rest](#rest)&nbsp;&nbsp;&nbsp; [second](#second)&nbsp;&nbsp;&nbsp; [sentence](#sentence)&nbsp;&nbsp;&nbsp; [slice](#slice)

### Math
[abs](#abs)&nbsp;&nbsp;&nbsp; [add](#add)&nbsp;&nbsp;&nbsp; [angle](#angle)&nbsp;&nbsp;&nbsp; [atan/2](#atan/2)&nbsp;&nbsp;&nbsp; [between?](#between)&nbsp;&nbsp;&nbsp; [ceil](#ceil)&nbsp;&nbsp;&nbsp; [cos](#cos)&nbsp;&nbsp;&nbsp; [dec](#dec)&nbsp;&nbsp;&nbsp; [deg/rad](#deg/rad)&nbsp;&nbsp;&nbsp; [deg/turn](#deg/turn)&nbsp;&nbsp;&nbsp; [dist](#dist)&nbsp;&nbsp;&nbsp; [div](#div)&nbsp;&nbsp;&nbsp; [div/0](#div/0)&nbsp;&nbsp;&nbsp; [div/safe](#div/safe)&nbsp;&nbsp;&nbsp; [even?](#even)&nbsp;&nbsp;&nbsp; [floor](#floor)&nbsp;&nbsp;&nbsp; [gt?](#gt)&nbsp;&nbsp;&nbsp; [gte?](#gte)&nbsp;&nbsp;&nbsp; [heading/vector](#heading/vector)&nbsp;&nbsp;&nbsp; [inc](#inc)&nbsp;&nbsp;&nbsp; [inv](#inv)&nbsp;&nbsp;&nbsp; [inv/0](#inv/0)&nbsp;&nbsp;&nbsp; [inv/safe](#inv/safe)&nbsp;&nbsp;&nbsp; [lt?](#lt)&nbsp;&nbsp;&nbsp; [lte?](#lte)&nbsp;&nbsp;&nbsp; [max](#max)&nbsp;&nbsp;&nbsp; [min](#min)&nbsp;&nbsp;&nbsp; [mod](#mod)&nbsp;&nbsp;&nbsp; [mod/0](#mod/0)&nbsp;&nbsp;&nbsp; [mod/safe](#mod/safe)&nbsp;&nbsp;&nbsp; [mult](#mult)&nbsp;&nbsp;&nbsp; [neg](#neg)&nbsp;&nbsp;&nbsp; [neg?](#neg)&nbsp;&nbsp;&nbsp; [odd?](#odd)&nbsp;&nbsp;&nbsp; [pi](#pi)&nbsp;&nbsp;&nbsp; [pos?](#pos)&nbsp;&nbsp;&nbsp; [rad/deg](#rad/deg)&nbsp;&nbsp;&nbsp; [rad/turn](#rad/turn)&nbsp;&nbsp;&nbsp; [random](#random)&nbsp;&nbsp;&nbsp; [random\_int](#random\_int)&nbsp;&nbsp;&nbsp; [range](#range)&nbsp;&nbsp;&nbsp; [round](#round)&nbsp;&nbsp;&nbsp; [sin](#sin)&nbsp;&nbsp;&nbsp; [sqrt](#sqrt)&nbsp;&nbsp;&nbsp; [sqrt/safe](#sqrt/safe)&nbsp;&nbsp;&nbsp; [square](#square)&nbsp;&nbsp;&nbsp; [sub](#sub)&nbsp;&nbsp;&nbsp; [sum\_of_squares](#sum\_of_squares)&nbsp;&nbsp;&nbsp; [tan](#tan)&nbsp;&nbsp;&nbsp; [tau](#tau)&nbsp;&nbsp;&nbsp; [turn/deg](#turn/deg)&nbsp;&nbsp;&nbsp; [turn/rad](#turn/rad)&nbsp;&nbsp;&nbsp; [zero?](#zero)

### Results
[err](#err)&nbsp;&nbsp;&nbsp; [err?](#err)&nbsp;&nbsp;&nbsp; [ok](#ok)&nbsp;&nbsp;&nbsp; [ok?](#ok)&nbsp;&nbsp;&nbsp; [unwrap!](#unwrap)&nbsp;&nbsp;&nbsp; [unwrap\_or](#unwrap\_or)

### Sets
[any?](#any)&nbsp;&nbsp;&nbsp; [append](#append)&nbsp;&nbsp;&nbsp; [coll?](#coll)&nbsp;&nbsp;&nbsp; [concat](#concat)&nbsp;&nbsp;&nbsp; [contains?](#contains)&nbsp;&nbsp;&nbsp; [count](#count)&nbsp;&nbsp;&nbsp; [empty?](#empty)&nbsp;&nbsp;&nbsp; [omit](#omit)&nbsp;&nbsp;&nbsp; [random](#random)&nbsp;&nbsp;&nbsp; [set](#set)&nbsp;&nbsp;&nbsp; [set?](#set)

### Strings
[any?](#any)&nbsp;&nbsp;&nbsp; [concat](#concat)&nbsp;&nbsp;&nbsp; [count](#count)&nbsp;&nbsp;&nbsp; [downcase](#downcase)&nbsp;&nbsp;&nbsp; [empty?](#empty)&nbsp;&nbsp;&nbsp; [join](#join)&nbsp;&nbsp;&nbsp; [sentence](#sentence)&nbsp;&nbsp;&nbsp; [show](#show)&nbsp;&nbsp;&nbsp; [slice](#slice)&nbsp;&nbsp;&nbsp; [split](#split)&nbsp;&nbsp;&nbsp; [string](#string)&nbsp;&nbsp;&nbsp; [string?](#string)&nbsp;&nbsp;&nbsp; [strip](#strip)&nbsp;&nbsp;&nbsp; [trim](#trim)&nbsp;&nbsp;&nbsp; [upcase](#upcase)&nbsp;&nbsp;&nbsp; [words](#words)

### Tuples
[any?](#any)&nbsp;&nbsp;&nbsp; [at](#at)&nbsp;&nbsp;&nbsp; [coll?](#coll)&nbsp;&nbsp;&nbsp; [count](#count)&nbsp;&nbsp;&nbsp; [empty?](#empty)&nbsp;&nbsp;&nbsp; [first](#first)&nbsp;&nbsp;&nbsp; [last](#last)&nbsp;&nbsp;&nbsp; [ordered?](#ordered)&nbsp;&nbsp;&nbsp; [rest](#rest)&nbsp;&nbsp;&nbsp; [second](#second)&nbsp;&nbsp;&nbsp; [tuple?](#tuple)

### Turtle graphics
[back!](#back)&nbsp;&nbsp;&nbsp; [background!](#background)&nbsp;&nbsp;&nbsp; [bk!](#bk)&nbsp;&nbsp;&nbsp; [clear!](#clear)&nbsp;&nbsp;&nbsp; [colors](#colors)&nbsp;&nbsp;&nbsp; [fd!](#fd)&nbsp;&nbsp;&nbsp; [forward!](#forward)&nbsp;&nbsp;&nbsp; [goto!](#goto)&nbsp;&nbsp;&nbsp; [heading](#heading)&nbsp;&nbsp;&nbsp; [heading/vector](#heading/vector)&nbsp;&nbsp;&nbsp; [home!](#home)&nbsp;&nbsp;&nbsp; [left!](#left)&nbsp;&nbsp;&nbsp; [lt!](#lt)&nbsp;&nbsp;&nbsp; [pc!](#pc)&nbsp;&nbsp;&nbsp; [pd!](#pd)&nbsp;&nbsp;&nbsp; [pencolor](#pencolor)&nbsp;&nbsp;&nbsp; [pencolor!](#pencolor)&nbsp;&nbsp;&nbsp; [pendown!](#pendown)&nbsp;&nbsp;&nbsp; [pendown?](#pendown)&nbsp;&nbsp;&nbsp; [penup!](#penup)&nbsp;&nbsp;&nbsp; [penwidth](#penwidth)&nbsp;&nbsp;&nbsp; [penwidth!](#penwidth)&nbsp;&nbsp;&nbsp; [position](#position)&nbsp;&nbsp;&nbsp; [pu!](#pu)&nbsp;&nbsp;&nbsp; [pw!](#pw)&nbsp;&nbsp;&nbsp; [render\_turtle!](#render\_turtle)&nbsp;&nbsp;&nbsp; [reset\_turtle!](#reset\_turtle)&nbsp;&nbsp;&nbsp; [right!](#right)&nbsp;&nbsp;&nbsp; [rt!](#rt)&nbsp;&nbsp;&nbsp; [turtle\_state](#turtle\_state)

### Types and values
[assoc?](#assoc)&nbsp;&nbsp;&nbsp; [bool?](#bool)&nbsp;&nbsp;&nbsp; [box?](#box)&nbsp;&nbsp;&nbsp; [coll?](#coll)&nbsp;&nbsp;&nbsp; [dict?](#dict)&nbsp;&nbsp;&nbsp; [eq?](#eq)&nbsp;&nbsp;&nbsp; [fn?](#fn)&nbsp;&nbsp;&nbsp; [keyword?](#keyword)&nbsp;&nbsp;&nbsp; [list?](#list)&nbsp;&nbsp;&nbsp; [neq?](#neq)&nbsp;&nbsp;&nbsp; [nil?](#nil)&nbsp;&nbsp;&nbsp; [number?](#number)&nbsp;&nbsp;&nbsp; [ordered?](#ordered)&nbsp;&nbsp;&nbsp; [set?](#set)&nbsp;&nbsp;&nbsp; [show](#show)&nbsp;&nbsp;&nbsp; [some](#some)&nbsp;&nbsp;&nbsp; [some?](#some)&nbsp;&nbsp;&nbsp; [string?](#string)&nbsp;&nbsp;&nbsp; [tuple?](#tuple)&nbsp;&nbsp;&nbsp; [type](#type)
    
## All functions, alphabetically
[abs](#abs)&nbsp;&nbsp;&nbsp; [add](#add)&nbsp;&nbsp;&nbsp; [and](#and)&nbsp;&nbsp;&nbsp; [angle](#angle)&nbsp;&nbsp;&nbsp; [any?](#any)&nbsp;&nbsp;&nbsp; [append](#append)&nbsp;&nbsp;&nbsp; [assert!](#assert)&nbsp;&nbsp;&nbsp; [assoc](#assoc)&nbsp;&nbsp;&nbsp; [assoc?](#assoc)&nbsp;&nbsp;&nbsp; [at](#at)&nbsp;&nbsp;&nbsp; [atan/2](#atan/2)&nbsp;&nbsp;&nbsp; [back!](#back)&nbsp;&nbsp;&nbsp; [background!](#background)&nbsp;&nbsp;&nbsp; [between?](#between)&nbsp;&nbsp;&nbsp; [bg!](#bg)&nbsp;&nbsp;&nbsp; [bgcolor](#bgcolor)&nbsp;&nbsp;&nbsp; [bk!](#bk)&nbsp;&nbsp;&nbsp; [bool](#bool)&nbsp;&nbsp;&nbsp; [bool?](#bool)&nbsp;&nbsp;&nbsp; [box?](#box)&nbsp;&nbsp;&nbsp; [butlast](#butlast)&nbsp;&nbsp;&nbsp; [ceil](#ceil)&nbsp;&nbsp;&nbsp; [clear!](#clear)&nbsp;&nbsp;&nbsp; [coll?](#coll)&nbsp;&nbsp;&nbsp; [colors](#colors)&nbsp;&nbsp;&nbsp; [concat](#concat)&nbsp;&nbsp;&nbsp; [contains?](#contains)&nbsp;&nbsp;&nbsp; [cos](#cos)&nbsp;&nbsp;&nbsp; [count](#count)&nbsp;&nbsp;&nbsp; [dec](#dec)&nbsp;&nbsp;&nbsp; [deg/rad](#deg/rad)&nbsp;&nbsp;&nbsp; [deg/turn](#deg/turn)&nbsp;&nbsp;&nbsp; [dict](#dict)&nbsp;&nbsp;&nbsp; [dict?](#dict)&nbsp;&nbsp;&nbsp; [diff](#diff)&nbsp;&nbsp;&nbsp; [dissoc](#dissoc)&nbsp;&nbsp;&nbsp; [dist](#dist)&nbsp;&nbsp;&nbsp; [div](#div)&nbsp;&nbsp;&nbsp; [div/0](#div/0)&nbsp;&nbsp;&nbsp; [div/safe](#div/safe)&nbsp;&nbsp;&nbsp; [doc!](#doc)&nbsp;&nbsp;&nbsp; [downcase](#downcase)&nbsp;&nbsp;&nbsp; [each!](#each)&nbsp;&nbsp;&nbsp; [empty?](#empty)&nbsp;&nbsp;&nbsp; [eq?](#eq)&nbsp;&nbsp;&nbsp; [err](#err)&nbsp;&nbsp;&nbsp; [err?](#err)&nbsp;&nbsp;&nbsp; [even?](#even)&nbsp;&nbsp;&nbsp; [false?](#false)&nbsp;&nbsp;&nbsp; [fd!](#fd)&nbsp;&nbsp;&nbsp; [filter](#filter)&nbsp;&nbsp;&nbsp; [first](#first)&nbsp;&nbsp;&nbsp; [floor](#floor)&nbsp;&nbsp;&nbsp; [fn?](#fn)&nbsp;&nbsp;&nbsp; [fold](#fold)&nbsp;&nbsp;&nbsp; [forward!](#forward)&nbsp;&nbsp;&nbsp; [get](#get)&nbsp;&nbsp;&nbsp; [goto!](#goto)&nbsp;&nbsp;&nbsp; [gt?](#gt)&nbsp;&nbsp;&nbsp; [gte?](#gte)&nbsp;&nbsp;&nbsp; [heading](#heading)&nbsp;&nbsp;&nbsp; [heading/vector](#heading/vector)&nbsp;&nbsp;&nbsp; [home!](#home)&nbsp;&nbsp;&nbsp; [inc](#inc)&nbsp;&nbsp;&nbsp; [inv](#inv)&nbsp;&nbsp;&nbsp; [inv/0](#inv/0)&nbsp;&nbsp;&nbsp; [inv/safe](#inv/safe)&nbsp;&nbsp;&nbsp; [join](#join)&nbsp;&nbsp;&nbsp; [keep](#keep)&nbsp;&nbsp;&nbsp; [keys](#keys)&nbsp;&nbsp;&nbsp; [keyword?](#keyword)&nbsp;&nbsp;&nbsp; [last](#last)&nbsp;&nbsp;&nbsp; [left!](#left)&nbsp;&nbsp;&nbsp; [list](#list)&nbsp;&nbsp;&nbsp; [list?](#list)&nbsp;&nbsp;&nbsp; [load\_turtle_state!](#load\_turtle_state)&nbsp;&nbsp;&nbsp; [lt!](#lt)&nbsp;&nbsp;&nbsp; [lt?](#lt)&nbsp;&nbsp;&nbsp; [lte?](#lte)&nbsp;&nbsp;&nbsp; [map](#map)&nbsp;&nbsp;&nbsp; [max](#max)&nbsp;&nbsp;&nbsp; [min](#min)&nbsp;&nbsp;&nbsp; [mod](#mod)&nbsp;&nbsp;&nbsp; [mod/0](#mod/0)&nbsp;&nbsp;&nbsp; [mod/safe](#mod/safe)&nbsp;&nbsp;&nbsp; [mult](#mult)&nbsp;&nbsp;&nbsp; [neg](#neg)&nbsp;&nbsp;&nbsp; [neg?](#neg)&nbsp;&nbsp;&nbsp; [neq?](#neq)&nbsp;&nbsp;&nbsp; [nil?](#nil)&nbsp;&nbsp;&nbsp; [not](#not)&nbsp;&nbsp;&nbsp; [odd?](#odd)&nbsp;&nbsp;&nbsp; [ok](#ok)&nbsp;&nbsp;&nbsp; [ok?](#ok)&nbsp;&nbsp;&nbsp; [omit](#omit)&nbsp;&nbsp;&nbsp; [or](#or)&nbsp;&nbsp;&nbsp; [ordered?](#ordered)&nbsp;&nbsp;&nbsp; [p5\_calls](#p5\_calls)&nbsp;&nbsp;&nbsp; [pc!](#pc)&nbsp;&nbsp;&nbsp; [pd!](#pd)&nbsp;&nbsp;&nbsp; [pencolor](#pencolor)&nbsp;&nbsp;&nbsp; [pencolor!](#pencolor)&nbsp;&nbsp;&nbsp; [pendown!](#pendown)&nbsp;&nbsp;&nbsp; [pendown?](#pendown)&nbsp;&nbsp;&nbsp; [penup!](#penup)&nbsp;&nbsp;&nbsp; [penwidth](#penwidth)&nbsp;&nbsp;&nbsp; [penwidth!](#penwidth)&nbsp;&nbsp;&nbsp; [pi](#pi)&nbsp;&nbsp;&nbsp; [pos?](#pos)&nbsp;&nbsp;&nbsp; [position](#position)&nbsp;&nbsp;&nbsp; [print!](#print)&nbsp;&nbsp;&nbsp; [pu!](#pu)&nbsp;&nbsp;&nbsp; [pw!](#pw)&nbsp;&nbsp;&nbsp; [rad/deg](#rad/deg)&nbsp;&nbsp;&nbsp; [rad/turn](#rad/turn)&nbsp;&nbsp;&nbsp; [random](#random)&nbsp;&nbsp;&nbsp; [random\_int](#random\_int)&nbsp;&nbsp;&nbsp; [range](#range)&nbsp;&nbsp;&nbsp; [render\_turtle!](#render\_turtle)&nbsp;&nbsp;&nbsp; [report!](#report)&nbsp;&nbsp;&nbsp; [reset\_turtle!](#reset\_turtle)&nbsp;&nbsp;&nbsp; [rest](#rest)&nbsp;&nbsp;&nbsp; [right!](#right)&nbsp;&nbsp;&nbsp; [round](#round)&nbsp;&nbsp;&nbsp; [rt!](#rt)&nbsp;&nbsp;&nbsp; [second](#second)&nbsp;&nbsp;&nbsp; [sentence](#sentence)&nbsp;&nbsp;&nbsp; [set](#set)&nbsp;&nbsp;&nbsp; [set?](#set)&nbsp;&nbsp;&nbsp; [show](#show)&nbsp;&nbsp;&nbsp; [sin](#sin)&nbsp;&nbsp;&nbsp; [slice](#slice)&nbsp;&nbsp;&nbsp; [some](#some)&nbsp;&nbsp;&nbsp; [some?](#some)&nbsp;&nbsp;&nbsp; [split](#split)&nbsp;&nbsp;&nbsp; [sqrt](#sqrt)&nbsp;&nbsp;&nbsp; [sqrt/safe](#sqrt/safe)&nbsp;&nbsp;&nbsp; [square](#square)&nbsp;&nbsp;&nbsp; [state](#state)&nbsp;&nbsp;&nbsp; [store!](#store)&nbsp;&nbsp;&nbsp; [string](#string)&nbsp;&nbsp;&nbsp; [string?](#string)&nbsp;&nbsp;&nbsp; [strip](#strip)&nbsp;&nbsp;&nbsp; [sub](#sub)&nbsp;&nbsp;&nbsp; [sum\_of_squares](#sum\_of_squares)&nbsp;&nbsp;&nbsp; [tan](#tan)&nbsp;&nbsp;&nbsp; [tau](#tau)&nbsp;&nbsp;&nbsp; [trim](#trim)&nbsp;&nbsp;&nbsp; [tuple?](#tuple)&nbsp;&nbsp;&nbsp; [turn/deg](#turn/deg)&nbsp;&nbsp;&nbsp; [turn/rad](#turn/rad)&nbsp;&nbsp;&nbsp; [turtle\_commands](#turtle\_commands)&nbsp;&nbsp;&nbsp; [turtle\_state](#turtle\_state)&nbsp;&nbsp;&nbsp; [turtle\_states](#turtle\_states)&nbsp;&nbsp;&nbsp; [type](#type)&nbsp;&nbsp;&nbsp; [unbox](#unbox)&nbsp;&nbsp;&nbsp; [unwrap!](#unwrap)&nbsp;&nbsp;&nbsp; [unwrap\_or](#unwrap\_or)&nbsp;&nbsp;&nbsp; [upcase](#upcase)&nbsp;&nbsp;&nbsp; [update](#update)&nbsp;&nbsp;&nbsp; [update!](#update)&nbsp;&nbsp;&nbsp; [values](#values)&nbsp;&nbsp;&nbsp; [words](#words)&nbsp;&nbsp;&nbsp; [ws?](#ws)&nbsp;&nbsp;&nbsp; [zero?](#zero)
## Function documentation

### abs
Returns the absolute value of a number.
```
(0)
(n as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### add
Adds numbers or vectors.
```
()
(x as :number)
(x as :number, y as :number)
(x, y, ...)
((x1, y1), (x2, y2))
```
[Back to top.](#ludus-prelude-documentation)

---
### and
Returns true if all values passed in are truthy. Note that this does not short-circuit: all arguments are evaulated before they are passed in.
```
()
(x)
(x, y)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### angle
Calculates the angle between two vectors.
```
(v1, v2)
```
[Back to top.](#ludus-prelude-documentation)

---
### any?
Returns true if something is not empty, otherwise returns false (including for things that can't be logically full, like numbers).
```
([...])
(#{...})
(s as :set)
((...))
(s as :string)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### append
Adds an element to a list or set.
```
()
(xs as :list)
(xs as :list, x)
(xs as :set)
(xs as :set, x)
```
[Back to top.](#ludus-prelude-documentation)

---
### assert!
Asserts a condition: returns the value if the value is truthy, panics if the value is falsy. Takes an optional message.
```
(value)
(msg, value)
```
[Back to top.](#ludus-prelude-documentation)

---
### assoc
Takes a dict, key, and value, and returns a new dict with the key set to value.
```
()
(dict as :dict)
(dict as :dict, key as :keyword, value)
(dict as :dict, (key as :keyword, value))
```
[Back to top.](#ludus-prelude-documentation)

---
### assoc?
Returns true if a value is an associative collection: a dict or a pkg.
```
(assoc as :dict)
(assoc as :pkg)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### at
Returns the element at index n of a list or tuple, or the byte at index n of a string. Zero-indexed: the first element is at index 0. Returns nil if nothing is found in a list or tuple; returns an empty string if nothing is found in a string.
```
(xs as :list, n as :number)
(xs as :tuple, n as :number)
(str as :string, n as :number)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### atan/2
Returns an angle from a slope. Takes an optional keyword argument to specify units. Takes either two numbers or a vector tuple.
```
(x as :number, y as :number)
(x, y, :turns)
(x, y, :radians)
(x, y, :degrees)
((x, y))
((x, y), units as :keyword)
```
[Back to top.](#ludus-prelude-documentation)

---
### back!
Moves the turtle backward by a number of steps. Alias: bk!
```
(steps as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### background!
Sets the background color behind the turtle and path. Alias: bg!
```
(gray as :number)
((r as :number, g as :number, b as :number))
((r as :number, g as :number, b as :number, a as :number))
```
[Back to top.](#ludus-prelude-documentation)

---
### between?
Returns true if a number is in the range [lower, higher): greater than or equal to the lower number, less than the higher.
```
(lower as :number, higher as :number, x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### bg!
Sets the background color behind the turtle and path. Alias: bg!
```
(gray as :number)
((r as :number, g as :number, b as :number))
((r as :number, g as :number, b as :number, a as :number))
```
[Back to top.](#ludus-prelude-documentation)

---
### bgcolor
No documentation available.

---
### bk!
Moves the turtle backward by a number of steps. Alias: bk!
```
(steps as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### bool
Returns false if a value is nil or false, otherwise returns true.
```
(nil)
(false)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### bool?
Returns true if a value is of type :boolean.
```
(false)
(true)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### box?
Returns true if a value is a box.
```
(b as :box)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### butlast
Returns a list, omitting the last element.
```
(xs as :list)
```
[Back to top.](#ludus-prelude-documentation)

---
### ceil
Truncates a number towards positive infinity. With negative numbers, it returns the integer part. With positive numbers, returns the next more-positive integer.
```
(n as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### clear!
Clears the canvas and sends the turtle home.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### coll?
Returns true if a value is a collection: dict, list, tuple, or set.
```
(coll as :dict)
(coll as :list)
(coll as :tuple)
(coll as :set)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### colors
No documentation available.

---
### concat
Combines two lists, strings, or sets.
```
(x as :string, y as :string)
(xs as :list, ys as :list)
(xs as :set, ys as :set)
(xs, ys, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### contains?
Returns true if a set or list contains a value.
```
(value, set as :set)
(value, list as :list)
```
[Back to top.](#ludus-prelude-documentation)

---
### cos
Returns the cosine of an angle. Default angle measure is turns. An optional keyword argument specifies the units of the angle passed in.
```
(a as :number)
(a as :number, :turns)
(a as :number, :degrees)
(a as :number, :radians)
```
[Back to top.](#ludus-prelude-documentation)

---
### count
Returns the number of elements in a collection (including string).
```
(xs as :list)
(xs as :tuple)
(xs as :dict)
(xs as :string)
(xs as :set)
```
[Back to top.](#ludus-prelude-documentation)

---
### dec
Decrements a number.
```
(x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### deg/rad
Converts an angle in degrees to an angle in radians.
```
(a as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### deg/turn
Converts an angle in degrees to an angle in turns.
```
(a as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### dict
Takes a list or tuple of (key, value) tuples and returns it as a dict. Returns dicts unharmed.
```
(dict as :dict)
(list as :list)
(tup as :tuple)
```
[Back to top.](#ludus-prelude-documentation)

---
### dict?
Returns true if a value is a dict.
```
(dict as :dict)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### diff
Takes two dicts and returns a dict describing their differences. Does this shallowly, offering diffs only for keys in the original dict.
```
(d1 as :dict, d2 as :dict)
```
[Back to top.](#ludus-prelude-documentation)

---
### dissoc
Takes a dict and a key, and returns a new dict with the key and associated value omitted.
```
(dict as :dict)
(dict as :dict, key as :keyword)
```
[Back to top.](#ludus-prelude-documentation)

---
### dist
Returns the distance from the origin to a point described by x and y, or by the vector (x, y).
```
(x as :number, y as :number)
((x, y))
```
[Back to top.](#ludus-prelude-documentation)

---
### div
Divides numbers. Panics on division by zero.
```
(x as :number)
(_, 0)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### div/0
Divides numbers. Returns 0 on division by zero.
```
(x as :number)
(_, 0)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### div/safe
Divides a number. Returns a result tuple.
```
(x as :number)
(_, 0)
(x, y)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### doc!
Prints the documentation of a function to the console.
```
(f as :fn)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### downcase
Takes a string and returns it in all lowercase. Works only for ascii characters.
```
(str as :string)
```
[Back to top.](#ludus-prelude-documentation)

---
### each!
Takes a list and applies a function, presumably with side effects, to each element in the list. Returns nil.
```
(f! as :fn, [])
(f! as :fn, [x])
(f! as :fn, [x, ...])
```
[Back to top.](#ludus-prelude-documentation)

---
### empty?
Returns true if something is empty. Otherwise returns false (including for things that can't logically be empty, like numbers).
```
([])
(#{})
(s as :set)
(())
("")
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### eq?
Returns true if all arguments have the same value.
```
(x)
(x, y)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### err
Takes a value and wraps it in an :err result tuple, presumably as an error message.
```
(msg)
```
[Back to top.](#ludus-prelude-documentation)

---
### err?
Takes a value and returns true if it is an :err result tuple.
```
((:err, _))
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### even?
Returns true if a value is an even number, otherwise returns false.
```
(x as :number)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### false?
Returns `true` if a value is `false`, otherwise returns `false`. Useful to distinguish between `false` and `nil`.
```
(false)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### fd!
Moves the turtle forward by a number of steps. Alias: fd!
```
(steps as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### filter
Takes a list and a predicate function, and returns a new list with only the items that produce truthy values when the function is called on them. E.g., `filter ([1, 2, 3, 4], odd?) &=> [1, 3]`.
```
(p? as :fn, xs)
```
[Back to top.](#ludus-prelude-documentation)

---
### first
Returns the first element of a list or tuple.
```
(xs)
```
[Back to top.](#ludus-prelude-documentation)

---
### floor
Truncates a number towards negative infinity. With positive numbers, it returns the integer part. With negative numbers, returns the next more-negative integer.
```
(n as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### fn?
Returns true if an argument is a function.
```
(f as :fn)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### fold
Folds a list.
```
(f as :fn, xs as :list)
(f as :fn, xs as :list, root)
```
[Back to top.](#ludus-prelude-documentation)

---
### forward!
Moves the turtle forward by a number of steps. Alias: fd!
```
(steps as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### get
Takes a key, dict, and optional default value; returns the value at key. If the value is not found, returns nil or the default value.
```
(key as :keyword)
(key as :keyword, dict as :dict)
(key as :keyword, dict as :dict, default)
```
[Back to top.](#ludus-prelude-documentation)

---
### goto!
Sends the turtle to (x, y) coordinates. If the pen is down, the turtle will draw a path to its new location.
```
(x as :number, y as :number)
((x, y))
```
[Back to top.](#ludus-prelude-documentation)

---
### gt?
Returns true if numbers are in decreasing order.
```
(x as :number)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### gte?
Returns true if numbers are in decreasing or flat order.
```
(x as :number)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### heading
Returns the turtle's current heading.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### heading/vector
Takes a turtle heading, and returns a unit vector of that heading.
```
(heading)
```
[Back to top.](#ludus-prelude-documentation)

---
### home!
Sends the turtle home: to the centre of the screen, pointing up. If the pen is down, the turtle will draw a path to home.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### inc
Increments a number.
```
(x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### inv
Returns the inverse of a number: 1/n or `div (1, n)`. Panics on division by zero.
```
(x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### inv/0
Returns the inverse of a number: 1/n or `div/0 (1, n)`. Returns 0 on division by zero.
```
(x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### inv/safe
Returns the inverse of a number: 1/n or `div/safe (1, n)`. Returns a result tuple.
```
(x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### join
Takes a list of strings, and joins them into a single string, interposing an optional separator.
```
([])
([str as :string])
(strs as :list)
([str as :string], separator as :string)
([str, ...], separator as :string)
```
[Back to top.](#ludus-prelude-documentation)

---
### keep
Takes a list and returns a new list with any `nil` values omitted.
```
(xs)
```
[Back to top.](#ludus-prelude-documentation)

---
### keys
Takes a dict and returns a list of keys in that dict.
```
(dict as :dict)
```
[Back to top.](#ludus-prelude-documentation)

---
### keyword?
Returns true if a value is a keyword, otherwise returns false.
```
(kw as :keyword)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### last
Returns the last element of a list or tuple.
```
(xs)
```
[Back to top.](#ludus-prelude-documentation)

---
### left!
Rotates the turtle left, measured in turns. Alias: lt!
```
(turns as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### list
Takes a value and returns it as a list. For values, it simply wraps them in a list. For collections, conversions are as follows. A tuple->list conversion preservers order and length. Unordered collections do not preserve order: sets and dicts don't have predictable or stable ordering in output. Dicts return lists of (key, value) tuples.
```
(x)
```
[Back to top.](#ludus-prelude-documentation)

---
### list?
Returns true if the value is a list.
```
(l as :list)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### load_turtle_state!
Sets the turtle state to a previously saved state. Returns the state.
```
(state)
```
[Back to top.](#ludus-prelude-documentation)

---
### lt!
Rotates the turtle left, measured in turns. Alias: lt!
```
(turns as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### lt?
Returns true if numbers are in increasing order.
```
(x as :number)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### lte?
Returns true if numbers are in increasing or flat order.
```
(x as :number)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### map
Maps a function over a list: returns a new list with elements that are the result of applying the function to each element in the original list. E.g., `map ([1, 2, 3], inc) &=> [2, 3, 4]`.
```
(f as :fn, xs)
(kw as :keyword, xs)
```
[Back to top.](#ludus-prelude-documentation)

---
### max
Returns the number in its arguments that is closest to positive infinity.
```
(x as :number)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### min
Returns the number in its arguments that is closest to negative infinity.
```
(x as :number)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### mod
Returns the modulus of num and div. Truncates towards negative infinity. Panics if div is 0.
```
(num as :number, 0)
(num as :number, div as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### mod/0
Returns the modulus of num and div. Truncates towards negative infinity. Returns 0 if div is 0.
```
(num as :number, 0)
(num as :number, div as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### mod/safe
Returns the modulus of num and div in a result tuple, or an error if div is 0. Truncates towards negative infinity.
```
(num as :number, 0)
(num as :number, div as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### mult
Multiplies numbers or vectors.
```
()
(x as :number)
(x as :number, y as :number)
(x, y, ...)
(scalar as :number, (x, y))
((x, y), scalar as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### neg
Multiplies a number by -1, negating it.
```
(n as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### neg?
Returns true if a value is a negative number, otherwise returns false.
```
(x as :number)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### neq?
Returns true if none of the arguments have the same value.
```
(x)
(x, y)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### nil?
Returns true if a value is nil.
```
(nil)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### not
Returns false if a value is truthy, true if a value is falsy.
```
(nil)
(false)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### odd?
Returns true if a value is an odd number, otherwise returns false.
```
(x as :number)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### ok
Takes a value and wraps it in an :ok result tuple.
```
(value)
```
[Back to top.](#ludus-prelude-documentation)

---
### ok?
Takes a value and returns true if it is an :ok result tuple.
```
((:ok, _))
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### omit
Returns a new set with the value omitted.
```
(value, s as :set)
```
[Back to top.](#ludus-prelude-documentation)

---
### or
Returns true if any value passed in is truthy. Note that this does not short-circuit: all arguments are evaluated before they are passed in.
```
()
(x)
(x, y)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### ordered?
Returns true if a value is an indexed collection: list or tuple.
```
(coll as :list)
(coll as :tuple)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### p5_calls
No documentation available.

---
### pc!
Changes the turtle's pen color. Takes a single grayscale value, an rgb tuple, or an rgba tuple. Alias: pc!
```
(gray as :number)
((r as :number, g as :number, b as :number))
((r as :number, g as :number, b as :number, a as :number))
```
[Back to top.](#ludus-prelude-documentation)

---
### pd!
Lowers the turtle's pen, causing it to draw. Alias: pd!
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### pencolor
Returns the turtle's pen color as an (r, g, b, a) tuple.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### pencolor!
Changes the turtle's pen color. Takes a single grayscale value, an rgb tuple, or an rgba tuple. Alias: pc!
```
(gray as :number)
((r as :number, g as :number, b as :number))
((r as :number, g as :number, b as :number, a as :number))
```
[Back to top.](#ludus-prelude-documentation)

---
### pendown!
Lowers the turtle's pen, causing it to draw. Alias: pd!
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### pendown?
Returns the turtle's pen state: true if the pen is down.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### penup!
Lifts the turtle's pen, stopping it from drawing. Alias: pu!
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### penwidth
Returns the turtle's pen width in pixels.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### penwidth!
Sets the width of the turtle's pen, measured in pixels. Alias: pw!
```
(width as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### pi
No documentation available.

---
### pos?
Returns true if a value is a positive number, otherwise returns false.
```
(x as :number)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### position
Returns the turtle's current position.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### print!
Sends a text representation of Ludus values to the console.
```
(...)
```
[Back to top.](#ludus-prelude-documentation)

---
### pu!
Lifts the turtle's pen, stopping it from drawing. Alias: pu!
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### pw!
Sets the width of the turtle's pen, measured in pixels. Alias: pw!
```
(width as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### rad/deg
Converts an angle in radians to an angle in degrees.
```
(a as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### rad/turn
Converts an angle in radians to an angle in turns.
```
(a as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### random
Returns a random something. With zero arguments, returns a random number between 0 (inclusive) and 1 (exclusive). With one argument, returns a random number between 0 and n. With two arguments, returns a random number between m and n. Alternately, given a collection (list, dict, set), it returns a random member of that collection.
```
()
(n as :number)
(m as :number, n as :number)
(l as :list)
(d as :dict)
(s as :set)
```
[Back to top.](#ludus-prelude-documentation)

---
### random_int
Returns a random integer. With one argument, returns a random integer between 0 and that number. With two arguments, returns a random integer between them.
```
(n as :number)
(m as :number, n as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### range
Returns the set of integers between start (inclusive) and end (exclusive) as a list: [start, end). With one argument, starts at 0. If end is less than start, returns an empty list.
```
(end as :number)
(start as :number, end as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### render_turtle!
No docstring available.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### report!
Prints a value, then returns it.
```
(x)
(msg as :string, x)
```
[Back to top.](#ludus-prelude-documentation)

---
### reset_turtle!
Resets the turtle to its original state.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### rest
Returns all but the first element of a list or tuple, as a list.
```
(xs as :list)
(xs as :tuple)
```
[Back to top.](#ludus-prelude-documentation)

---
### right!
Rotates the turtle right, measured in turns. Alias: rt!
```
(turns as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### round
Rounds a number to the nearest integer.
```
(n as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### rt!
Rotates the turtle right, measured in turns. Alias: rt!
```
(turns as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### second
Returns the second element of a list or tuple.
```
(xs)
```
[Back to top.](#ludus-prelude-documentation)

---
### sentence
Takes a list of words and turns it into a sentence.
```
(strs as :list)
```
[Back to top.](#ludus-prelude-documentation)

---
### set
Takes an ordered collection--list or tuple--and turns it into a set.
```
(xs as :list)
(xs as :tuple)
```
[Back to top.](#ludus-prelude-documentation)

---
### set?
Returns true if a value is a set.
```
(xs as :set)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### show
Returns a text representation of a Ludus value as a string.
```
(x)
```
[Back to top.](#ludus-prelude-documentation)

---
### sin
Returns the sine of an angle. Default angle measure is turns. An optional keyword argument specifies the units of the angle passed in.
```
(a as :number)
(a as :number, :turns)
(a as :number, :degrees)
(a as :number, :radians)
```
[Back to top.](#ludus-prelude-documentation)

---
### slice
Returns a slice of a list or a string, representing a sub-list or sub-string.
```
(xs as :list, end as :number)
(xs as :list, start as :number, end as :number)
(str as :string, end as :number)
(str as :string, start as :number, end as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### some
Takes a possibly nil value and a default value. Returns the value if it's not nil, returns the default if it's nil.
```
(nil, default)
(value, _)
```
[Back to top.](#ludus-prelude-documentation)

---
### some?
Returns true if a value is not nil.
```
(nil)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### split
Takes a string, and turns it into a list of strings, breaking on the separator.
```
(str as :string, break as :string)
```
[Back to top.](#ludus-prelude-documentation)

---
### sqrt
Returns the square root of a number. Panics if the number is negative.
```
(x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### sqrt/safe
Returns a result containing the square root of a number, or an error if the number is negative.
```
(x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### square
Squares a number.
```
(x as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### state
No documentation available.

---
### store!
Stores a value in a box, replacing the value that was previously there. Returns the value.
```
(b as :box, value)
```
[Back to top.](#ludus-prelude-documentation)

---
### string
Converts a value to a string by using `show`. If it is a string, returns it unharmed. Use this to build up strings of different kinds of values.
```
(x as :string)
(x)
(x, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### string?
Returns true if a value is a string.
```
(x as :string)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### strip
Removes punctuation from a string, removing all instances of ,.;:?!
```
("{x},{y}")
("{x}.{y}")
("{x};{y}")
("{x}:{y}")
("{x}?{y}")
("{x}!{y}")
(x)
```
[Back to top.](#ludus-prelude-documentation)

---
### sub
Subtracts numbers or vectors.
```
()
(x as :number)
(x as :number, y as :number)
(x, y, ...)
((x1, y1), (x2, y2))
```
[Back to top.](#ludus-prelude-documentation)

---
### sum_of_squares
Returns the sum of squares of numbers.
```
()
(x as :number)
(x as :number, y as :number)
(x, y, ...)
```
[Back to top.](#ludus-prelude-documentation)

---
### tan
Returns the sine of an angle. Default angle measure is turns. An optional keyword argument specifies the units of the angle passed in.
```
(a as :number)
(a as :number, :turns)
(a as :number, :degrees)
(a as :number, :radians)
```
[Back to top.](#ludus-prelude-documentation)

---
### tau
No documentation available.

---
### trim
Trims whitespace from a string. Takes an optional argument, `:left` or `:right`, to trim only on the left or right.
```
(str as :string)
(str as :string, :left)
(str as :string, :right)
```
[Back to top.](#ludus-prelude-documentation)

---
### tuple?
Returns true if a value is a tuple.
```
(tuple as :tuple)
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### turn/deg
Converts an angle in turns to an angle in degrees.
```
(a as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### turn/rad
Converts an angle in turns to an angle in radians.
```
(a as :number)
```
[Back to top.](#ludus-prelude-documentation)

---
### turtle_commands
No documentation available.

---
### turtle_state
Returns the turtle's current state.
```
()
```
[Back to top.](#ludus-prelude-documentation)

---
### turtle_states
No documentation available.

---
### type
Returns a keyword representing the type of the value passed in.
```
(x)
```
[Back to top.](#ludus-prelude-documentation)

---
### unbox
Returns the value that is stored in a box.
```
(b as :box)
```
[Back to top.](#ludus-prelude-documentation)

---
### unwrap!
Takes a result tuple. If it's :ok, then returns the value. If it's not :ok, then it panics. If it's not a result tuple, it also panics.
```
((:ok, value))
((:err, msg))
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### unwrap_or
Takes a value that is a result tuple and a default value. If it's :ok, then it returns the value. If it's :err, returns the default value.
```
((:ok, value), _)
((:err, _), default)
```
[Back to top.](#ludus-prelude-documentation)

---
### upcase
Takes a string and returns it in all uppercase. Works only for ascii characters.
```
(str as :string)
```
[Back to top.](#ludus-prelude-documentation)

---
### update
Takes a dict, key, and function, and returns a new dict with the key set to the result of applying the function to original value held at the key.
```
(dict as :dict)
(dict as :dict, key as :keyword, updater as :fn)
```
[Back to top.](#ludus-prelude-documentation)

---
### update!
Updates a box by applying a function to its value. Returns the new value.
```
(b as :box, f as :fn)
```
[Back to top.](#ludus-prelude-documentation)

---
### values
Takes a dict and returns a list of values in that dict.
```
(dict)
```
[Back to top.](#ludus-prelude-documentation)

---
### words
Takes a string and returns a list of the words in the string. Strips all whitespace.
```
(str as :string)
```
[Back to top.](#ludus-prelude-documentation)

---
### ws?
Tells if a string is a whitespace character.
```
(" ")
("\n")
("\t")
(_)
```
[Back to top.](#ludus-prelude-documentation)

---
### zero?
Returns true if a number is 0.
```
(0)
(_)
```
[Back to top.](#ludus-prelude-documentation)
