Update docs
This commit is contained in:
parent
3c25fc72eb
commit
6c773e65e9
18
prelude.md
18
prelude.md
|
@ -12,6 +12,24 @@ 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.
|
**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.
|
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` (indexed collections); `:set` (sets are specific),
|
||||||
|
`:dict` and `:ns` (associative collections); and `:ref` (references).
|
||||||
|
|
||||||
|
**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)`.
|
||||||
|
`add` and `mult` can take vectors as well as numbers.
|
||||||
|
|
||||||
[abs](#abs) [add](#add) [and](#and) [angle](#angle) [append](#append) [assert!](#assert) [assoc](#assoc) [assoc?](#assoc) [at](#at) [atan/2](#atan/2) [back!](#back) [background!](#background) [bg!](#bg) [bgcolor](#bgcolor) [bk!](#bk) [bool](#bool) [bool?](#bool) [butlast](#butlast) [ceil](#ceil) [clear!](#clear) [coll?](#coll) [colors](#colors) [concat](#concat) [console](#console) [cos](#cos) [count](#count) [dec](#dec) [deg/rad](#deg/rad) [deg/turn](#deg/turn) [deref](#deref) [dict](#dict) [diff](#diff) [dissoc](#dissoc) [dist](#dist) [div](#div) [div/0](#div/0) [div/safe](#div/safe) [doc!](#doc) [each!](#each) [eq?](#eq) [err](#err) [err?](#err) [even?](#even) [false?](#false) [fd!](#fd) [first](#first) [floor](#floor) [flush!](#flush) [fn?](#fn) [fold](#fold) [forward!](#forward) [get](#get) [goto!](#goto) [gt?](#gt) [gte?](#gte) [heading](#heading) [heading/vector](#heading/vector) [home!](#home) [inc](#inc) [join](#join) [keys](#keys) [keyword?](#keyword) [last](#last) [left!](#left) [list](#list) [lt!](#lt) [lt?](#lt) [lte?](#lte) [make!](#make) [map](#map) [mod](#mod) [mult](#mult) [neg](#neg) [neg?](#neg) [nil?](#nil) [not](#not) [odd?](#odd) [ok](#ok) [ok?](#ok) [or](#or) [ordered?](#ordered) [p5_calls](#p5_calls) [panic!](#panic) [pc!](#pc) [pd!](#pd) [pencolor](#pencolor) [pencolor!](#pencolor) [pendown!](#pendown) [pendown?](#pendown) [penup!](#penup) [penwidth](#penwidth) [penwidth!](#penwidth) [pi](#pi) [pos?](#pos) [position](#position) [print!](#print) [prn!](#prn) [pu!](#pu) [pw!](#pw) [rad/deg](#rad/deg) [rad/turn](#rad/turn) [random](#random) [range](#range) [render_turtle!](#render_turtle) [report!](#report) [reset_turtle!](#reset_turtle) [rest](#rest) [right!](#right) [round](#round) [rt!](#rt) [second](#second) [set](#set) [show](#show) [sin](#sin) [slice](#slice) [some](#some) [some?](#some) [square](#square) [string](#string) [string?](#string) [sub](#sub) [sum_of_squares](#sum_of_squares) [tan](#tan) [tau](#tau) [turn/deg](#turn/deg) [turn/rad](#turn/rad) [turtle_commands](#turtle_commands) [turtle_state](#turtle_state) [turtle_states](#turtle_states) [type](#type) [unwrap!](#unwrap) [unwrap_or](#unwrap_or) [update](#update) [update!](#update) [values](#values) [zero?](#zero)
|
[abs](#abs) [add](#add) [and](#and) [angle](#angle) [append](#append) [assert!](#assert) [assoc](#assoc) [assoc?](#assoc) [at](#at) [atan/2](#atan/2) [back!](#back) [background!](#background) [bg!](#bg) [bgcolor](#bgcolor) [bk!](#bk) [bool](#bool) [bool?](#bool) [butlast](#butlast) [ceil](#ceil) [clear!](#clear) [coll?](#coll) [colors](#colors) [concat](#concat) [console](#console) [cos](#cos) [count](#count) [dec](#dec) [deg/rad](#deg/rad) [deg/turn](#deg/turn) [deref](#deref) [dict](#dict) [diff](#diff) [dissoc](#dissoc) [dist](#dist) [div](#div) [div/0](#div/0) [div/safe](#div/safe) [doc!](#doc) [each!](#each) [eq?](#eq) [err](#err) [err?](#err) [even?](#even) [false?](#false) [fd!](#fd) [first](#first) [floor](#floor) [flush!](#flush) [fn?](#fn) [fold](#fold) [forward!](#forward) [get](#get) [goto!](#goto) [gt?](#gt) [gte?](#gte) [heading](#heading) [heading/vector](#heading/vector) [home!](#home) [inc](#inc) [join](#join) [keys](#keys) [keyword?](#keyword) [last](#last) [left!](#left) [list](#list) [lt!](#lt) [lt?](#lt) [lte?](#lte) [make!](#make) [map](#map) [mod](#mod) [mult](#mult) [neg](#neg) [neg?](#neg) [nil?](#nil) [not](#not) [odd?](#odd) [ok](#ok) [ok?](#ok) [or](#or) [ordered?](#ordered) [p5_calls](#p5_calls) [panic!](#panic) [pc!](#pc) [pd!](#pd) [pencolor](#pencolor) [pencolor!](#pencolor) [pendown!](#pendown) [pendown?](#pendown) [penup!](#penup) [penwidth](#penwidth) [penwidth!](#penwidth) [pi](#pi) [pos?](#pos) [position](#position) [print!](#print) [prn!](#prn) [pu!](#pu) [pw!](#pw) [rad/deg](#rad/deg) [rad/turn](#rad/turn) [random](#random) [range](#range) [render_turtle!](#render_turtle) [report!](#report) [reset_turtle!](#reset_turtle) [rest](#rest) [right!](#right) [round](#round) [rt!](#rt) [second](#second) [set](#set) [show](#show) [sin](#sin) [slice](#slice) [some](#some) [some?](#some) [square](#square) [string](#string) [string?](#string) [sub](#sub) [sum_of_squares](#sum_of_squares) [tan](#tan) [tau](#tau) [turn/deg](#turn/deg) [turn/rad](#turn/rad) [turtle_commands](#turtle_commands) [turtle_state](#turtle_state) [turtle_states](#turtle_states) [type](#type) [unwrap!](#unwrap) [unwrap_or](#unwrap_or) [update](#update) [update!](#update) [values](#values) [zero?](#zero)
|
||||||
## Function documentation
|
## Function documentation
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
54180
|
|
Loading…
Reference in New Issue
Block a user