From d1c48fb0fdd7fff77839822ec93b1b809e0e5980 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Sat, 15 Jun 2024 18:14:03 -0400 Subject: [PATCH] add hrs --- prelude.md | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) diff --git a/prelude.md b/prelude.md index 62df3ea..2d9cec6 100644 --- a/prelude.md +++ b/prelude.md @@ -75,6 +75,7 @@ You can see what this looks like in the last clause of `add`: `((x1, y1), (x2, y ## All functions, alphabetically [abs](#abs)    [add](#add)    [and](#and)    [angle](#angle)    [any?](#any)    [append](#append)    [assert!](#assert)    [assoc](#assoc)    [assoc?](#assoc)    [at](#at)    [atan/2](#atan/2)    [back!](#back)    [background!](#background)    [between?](#between)    [bg!](#bg)    [bgcolor](#bgcolor)    [bk!](#bk)    [bool](#bool)    [bool?](#bool)    [box?](#box)    [butlast](#butlast)    [ceil](#ceil)    [clear!](#clear)    [coll?](#coll)    [colors](#colors)    [concat](#concat)    [cos](#cos)    [count](#count)    [dec](#dec)    [deg/rad](#deg/rad)    [deg/turn](#deg/turn)    [dict](#dict)    [dict?](#dict)    [diff](#diff)    [dissoc](#dissoc)    [dist](#dist)    [div](#div)    [div/0](#div/0)    [div/safe](#div/safe)    [doc!](#doc)    [downcase](#downcase)    [each!](#each)    [empty?](#empty)    [eq?](#eq)    [err](#err)    [err?](#err)    [even?](#even)    [false?](#false)    [fd!](#fd)    [filter](#filter)    [first](#first)    [floor](#floor)    [fn?](#fn)    [fold](#fold)    [forward!](#forward)    [get](#get)    [goto!](#goto)    [gt?](#gt)    [gte?](#gte)    [heading](#heading)    [heading/vector](#heading/vector)    [home!](#home)    [inc](#inc)    [inv](#inv)    [inv/0](#inv/0)    [inv/safe](#inv/safe)    [join](#join)    [keep](#keep)    [keys](#keys)    [keyword?](#keyword)    [last](#last)    [left!](#left)    [list](#list)    [list?](#list)    [load\_turtle_state!](#load\_turtle_state)    [lt!](#lt)    [lt?](#lt)    [lte?](#lte)    [map](#map)    [max](#max)    [min](#min)    [mod](#mod)    [mult](#mult)    [neg](#neg)    [neg?](#neg)    [neq?](#neq)    [nil?](#nil)    [not](#not)    [odd?](#odd)    [ok](#ok)    [ok?](#ok)    [or](#or)    [ordered?](#ordered)    [p5\_calls](#p5\_calls)    [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)    [pu!](#pu)    [pw!](#pw)    [rad/deg](#rad/deg)    [rad/turn](#rad/turn)    [random](#random)    [random\_int](#random\_int)    [range](#range)    [render\_turtle!](#render\_turtle)    [report!](#report)    [reset\_turtle!](#reset\_turtle)    [rest](#rest)    [right!](#right)    [round](#round)    [rt!](#rt)    [second](#second)    [sentence](#sentence)    [set](#set)    [set?](#set)    [show](#show)    [sin](#sin)    [slice](#slice)    [some](#some)    [some?](#some)    [split](#split)    [square](#square)    [state](#state)    [store!](#store)    [string](#string)    [string?](#string)    [strip](#strip)    [sub](#sub)    [sum\_of_squares](#sum\_of_squares)    [tan](#tan)    [tau](#tau)    [trim](#trim)    [tuple?](#tuple)    [turn/deg](#turn/deg)    [turn/rad](#turn/rad)    [turtle\_commands](#turtle\_commands)    [turtle\_state](#turtle\_state)    [turtle\_states](#turtle\_states)    [type](#type)    [unbox](#unbox)    [unwrap!](#unwrap)    [unwrap\_or](#unwrap\_or)    [upcase](#upcase)    [update](#update)    [update!](#update)    [values](#values)    [words](#words)    [ws?](#ws)    [zero?](#zero) ## Function documentation +--- ### abs Returns the absolute value of a number. ``` @@ -84,6 +85,7 @@ Returns the absolute value of a number. [Back to top.](#ludus-prelude-documentation) +--- ### add Adds numbers or vectors. ``` @@ -96,6 +98,7 @@ Adds numbers or vectors. [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. ``` @@ -107,6 +110,7 @@ Returns true if all values passed in are truthy. Note that this does not short-c [Back to top.](#ludus-prelude-documentation) +--- ### angle Calculates the angle between two vectors. ``` @@ -115,6 +119,7 @@ Calculates the angle between two vectors. [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). ``` @@ -128,6 +133,7 @@ Returns true if something is not empty, otherwise returns false (including for t [Back to top.](#ludus-prelude-documentation) +--- ### append Adds an element to a list or set. ``` @@ -140,6 +146,7 @@ Adds an element to a list or set. [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. ``` @@ -149,6 +156,7 @@ Asserts a condition: returns the value if the value is truthy, panics if the val [Back to top.](#ludus-prelude-documentation) +--- ### assoc Takes a dict, key, and value, and returns a new dict with the key set to value. ``` @@ -160,6 +168,7 @@ Takes a dict, key, and value, and returns a new dict with the key set to value. [Back to top.](#ludus-prelude-documentation) +--- ### assoc? Returns true if a value is an associative collection: a dict or a pkg. ``` @@ -170,6 +179,7 @@ Returns true if a value is an associative collection: a dict or a 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. ``` @@ -181,6 +191,7 @@ Returns the element at index n of a list or tuple, or the byte at index n of a s [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. ``` @@ -194,6 +205,7 @@ Returns an angle from a slope. Takes an optional keyword argument to specify uni [Back to top.](#ludus-prelude-documentation) +--- ### back! Moves the turtle backward by a number of steps. Alias: bk! ``` @@ -202,6 +214,7 @@ Moves the turtle backward by a number of steps. Alias: bk! [Back to top.](#ludus-prelude-documentation) +--- ### background! Sets the background color behind the turtle and path. Alias: bg! ``` @@ -212,6 +225,7 @@ Sets the background color behind the turtle and path. Alias: bg! [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. ``` @@ -220,6 +234,7 @@ Returns true if a number is in the range [lower, higher): greater than or equal [Back to top.](#ludus-prelude-documentation) +--- ### bg! Sets the background color behind the turtle and path. Alias: bg! ``` @@ -230,10 +245,12 @@ Sets the background color behind the turtle and path. Alias: bg! [Back to top.](#ludus-prelude-documentation) +--- ### bgcolor No documentation available. +--- ### bk! Moves the turtle backward by a number of steps. Alias: bk! ``` @@ -242,6 +259,7 @@ Moves the turtle backward by a number of steps. Alias: bk! [Back to top.](#ludus-prelude-documentation) +--- ### bool Returns false if a value is nil or false, otherwise returns true. ``` @@ -252,6 +270,7 @@ Returns false if a value is nil or false, otherwise returns true. [Back to top.](#ludus-prelude-documentation) +--- ### bool? Returns true if a value is of type :boolean. ``` @@ -262,6 +281,7 @@ Returns true if a value is of type :boolean. [Back to top.](#ludus-prelude-documentation) +--- ### box? Returns true if a value is a box. ``` @@ -271,6 +291,7 @@ Returns true if a value is a box. [Back to top.](#ludus-prelude-documentation) +--- ### butlast Returns a list, omitting the last element. ``` @@ -279,6 +300,7 @@ Returns a list, omitting the last element. [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. ``` @@ -287,6 +309,7 @@ Truncates a number towards positive infinity. With negative numbers, it returns [Back to top.](#ludus-prelude-documentation) +--- ### clear! Clears the canvas and sends the turtle home. ``` @@ -295,6 +318,7 @@ 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, pkg, tuple, or set. ``` @@ -308,10 +332,12 @@ Returns true if a value is a collection: dict, list, pkg, tuple, or set. [Back to top.](#ludus-prelude-documentation) +--- ### colors No documentation available. +--- ### concat Combines two lists, strings, or sets. ``` @@ -323,6 +349,7 @@ Combines two lists, strings, or sets. [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. ``` @@ -334,6 +361,7 @@ Returns the cosine of an angle. Default angle measure is turns. An optional keyw [Back to top.](#ludus-prelude-documentation) +--- ### count Returns the number of elements in a collection (including string). ``` @@ -346,6 +374,7 @@ Returns the number of elements in a collection (including string). [Back to top.](#ludus-prelude-documentation) +--- ### dec Decrements a number. ``` @@ -354,6 +383,7 @@ Decrements a number. [Back to top.](#ludus-prelude-documentation) +--- ### deg/rad Converts an angle in degrees to an angle in radians. ``` @@ -362,6 +392,7 @@ Converts an angle in degrees to an angle in radians. [Back to top.](#ludus-prelude-documentation) +--- ### deg/turn Converts an angle in degrees to an angle in turns. ``` @@ -370,6 +401,7 @@ Converts an angle in degrees to an angle in turns. [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. ``` @@ -380,6 +412,7 @@ Takes a list or tuple of (key, value) tuples and returns it as a dict. Returns d [Back to top.](#ludus-prelude-documentation) +--- ### dict? Returns true if a value is a dict. ``` @@ -389,6 +422,7 @@ Returns true if a value is a 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. ``` @@ -397,6 +431,7 @@ Takes two dicts and returns a dict describing their differences. Does this shall [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. ``` @@ -406,6 +441,7 @@ Takes a dict and a key, and returns a new dict with the key and associated value [Back to top.](#ludus-prelude-documentation) +--- ### dist Returns the distance from the origin to a point described by (x, y). ``` @@ -415,6 +451,7 @@ Returns the distance from the origin to a point described by (x, y). [Back to top.](#ludus-prelude-documentation) +--- ### div Divides numbers. Panics on division by zero. ``` @@ -426,6 +463,7 @@ Divides numbers. Panics on division by zero. [Back to top.](#ludus-prelude-documentation) +--- ### div/0 Divides numbers. Returns 0 on division by zero. ``` @@ -437,6 +475,7 @@ Divides numbers. Returns 0 on division by zero. [Back to top.](#ludus-prelude-documentation) +--- ### div/safe Divides a number. Returns a result tuple. ``` @@ -448,6 +487,7 @@ Divides a number. Returns a result tuple. [Back to top.](#ludus-prelude-documentation) +--- ### doc! Prints the documentation of a function to the console. ``` @@ -457,6 +497,7 @@ Prints the documentation of a function to the console. [Back to top.](#ludus-prelude-documentation) +--- ### downcase Takes a string and returns it in all lowercase. Works only for ascii characters. ``` @@ -465,6 +506,7 @@ Takes a string and returns it in all lowercase. Works only for ascii characters. [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. ``` @@ -475,6 +517,7 @@ Takes a list and applies a function, presumably with side effects, to each eleme [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). ``` @@ -488,6 +531,7 @@ Returns true if something is empty. Otherwise returns false (including for thing [Back to top.](#ludus-prelude-documentation) +--- ### eq? Returns true if all arguments have the same value. ``` @@ -498,6 +542,7 @@ Returns true if all arguments have the same value. [Back to top.](#ludus-prelude-documentation) +--- ### err Takes a value and wraps it in an :err result tuple, presumably as an error message. ``` @@ -506,6 +551,7 @@ Takes a value and wraps it in an :err result tuple, presumably as an error messa [Back to top.](#ludus-prelude-documentation) +--- ### err? Takes a value and returns true if it is an :err result tuple. ``` @@ -515,6 +561,7 @@ Takes a value and returns true if it is an :err result tuple. [Back to top.](#ludus-prelude-documentation) +--- ### even? Returns true if a value is an even number, otherwise returns false. ``` @@ -524,6 +571,7 @@ Returns true if a value is an even number, otherwise returns false. [Back to top.](#ludus-prelude-documentation) +--- ### false? Returns `true` if a value is `false`, otherwise returns `false`. Useful to distinguish between `false` and `nil`. ``` @@ -533,6 +581,7 @@ Returns `true` if a value is `false`, otherwise returns `false`. Useful to disti [Back to top.](#ludus-prelude-documentation) +--- ### fd! Moves the turtle forward by a number of steps. Alias: fd! ``` @@ -541,6 +590,7 @@ Moves the turtle forward by a number of steps. Alias: fd! [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]`. ``` @@ -549,6 +599,7 @@ Takes a list and a predicate function, and returns a new list with only the item [Back to top.](#ludus-prelude-documentation) +--- ### first Returns the first element of a list or tuple. ``` @@ -557,6 +608,7 @@ Returns the first element of a list or tuple. [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. ``` @@ -565,6 +617,7 @@ Truncates a number towards negative infinity. With positive numbers, it returns [Back to top.](#ludus-prelude-documentation) +--- ### fn? Returns true if an argument is a function. ``` @@ -574,6 +627,7 @@ Returns true if an argument is a function. [Back to top.](#ludus-prelude-documentation) +--- ### fold Folds a list. ``` @@ -583,6 +637,7 @@ Folds a list. [Back to top.](#ludus-prelude-documentation) +--- ### forward! Moves the turtle forward by a number of steps. Alias: fd! ``` @@ -591,6 +646,7 @@ Moves the turtle forward by a number of steps. Alias: fd! [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. ``` @@ -601,6 +657,7 @@ Takes a key, dict, and optional default value; returns the value at key. If the [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. ``` @@ -610,6 +667,7 @@ Sends the turtle to (x, y) coordinates. If the pen is down, the turtle will draw [Back to top.](#ludus-prelude-documentation) +--- ### gt? Returns true if numbers are in decreasing order. ``` @@ -620,6 +678,7 @@ Returns true if numbers are in decreasing order. [Back to top.](#ludus-prelude-documentation) +--- ### gte? Returns true if numbers are in decreasing or flat order. ``` @@ -630,6 +689,7 @@ Returns true if numbers are in decreasing or flat order. [Back to top.](#ludus-prelude-documentation) +--- ### heading Returns the turtle's current heading. ``` @@ -638,6 +698,7 @@ 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. ``` @@ -646,6 +707,7 @@ Takes a turtle heading, and returns a unit vector of that 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. ``` @@ -654,6 +716,7 @@ Sends the turtle home: to the centre of the screen, pointing up. If the pen is d [Back to top.](#ludus-prelude-documentation) +--- ### inc Increments a number. ``` @@ -662,6 +725,7 @@ Increments a 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. ``` @@ -670,6 +734,7 @@ Returns the inverse of a number: 1/n or `div (1, n)`. Panics on division by zero [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. ``` @@ -678,6 +743,7 @@ Returns the inverse of a number: 1/n or `div/0 (1, n)`. Returns 0 on division by [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. ``` @@ -686,6 +752,7 @@ Returns the inverse of a number: 1/n or `div/safe (1, n)`. Returns a result tupl [Back to top.](#ludus-prelude-documentation) +--- ### join Takes a list of strings, and joins them into a single string, interposing an optional separator. ``` @@ -698,6 +765,7 @@ Takes a list of strings, and joins them into a single string, interposing an opt [Back to top.](#ludus-prelude-documentation) +--- ### keep Takes a list and returns a new list with any `nil` values omitted. ``` @@ -706,6 +774,7 @@ Takes a list and returns a new list with any `nil` values omitted. [Back to top.](#ludus-prelude-documentation) +--- ### keys Takes a dict and returns a list of keys in that dict. ``` @@ -714,6 +783,7 @@ Takes a dict and returns a list of keys in that dict. [Back to top.](#ludus-prelude-documentation) +--- ### keyword? Returns true if a value is a keyword, otherwise returns false. ``` @@ -723,6 +793,7 @@ Returns true if a value is a keyword, otherwise returns false. [Back to top.](#ludus-prelude-documentation) +--- ### last Returns the last element of a list or tuple. ``` @@ -731,6 +802,7 @@ Returns the last element of a list or tuple. [Back to top.](#ludus-prelude-documentation) +--- ### left! Rotates the turtle left, measured in turns. Alias: lt! ``` @@ -739,6 +811,7 @@ Rotates the turtle left, measured in turns. Alias: lt! [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. Associative collections return lists of (key, value) tuples. ``` @@ -747,6 +820,7 @@ Takes a value and returns it as a list. For values, it simply wraps them in a li [Back to top.](#ludus-prelude-documentation) +--- ### list? Returns true if the value is a list. ``` @@ -756,6 +830,7 @@ Returns true if the value is a list. [Back to top.](#ludus-prelude-documentation) +--- ### load_turtle_state! Sets the turtle state to a previously saved state. Returns the state. ``` @@ -764,6 +839,7 @@ Sets the turtle state to a previously saved state. Returns the state. [Back to top.](#ludus-prelude-documentation) +--- ### lt! Rotates the turtle left, measured in turns. Alias: lt! ``` @@ -772,6 +848,7 @@ Rotates the turtle left, measured in turns. Alias: lt! [Back to top.](#ludus-prelude-documentation) +--- ### lt? Returns true if numbers are in increasing order. ``` @@ -782,6 +859,7 @@ Returns true if numbers are in increasing order. [Back to top.](#ludus-prelude-documentation) +--- ### lte? Returns true if numbers are in increasing or flat order. ``` @@ -792,6 +870,7 @@ Returns true if numbers are in increasing or flat order. [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]`. ``` @@ -801,6 +880,7 @@ Maps a function over a list: returns a new list with elements that are the resul [Back to top.](#ludus-prelude-documentation) +--- ### max Returns the number in its arguments that is closest to positive infinity. ``` @@ -811,6 +891,7 @@ Returns the number in its arguments that is closest to positive infinity. [Back to top.](#ludus-prelude-documentation) +--- ### min Returns the number in its arguments that is closest to negative infinity. ``` @@ -821,6 +902,7 @@ Returns the number in its arguments that is closest to negative infinity. [Back to top.](#ludus-prelude-documentation) +--- ### mod Returns the modulus of num and div. Truncates towards negative infinity. ``` @@ -829,6 +911,7 @@ Returns the modulus of num and div. Truncates towards negative infinity. [Back to top.](#ludus-prelude-documentation) +--- ### mult Multiplies numbers or vectors. ``` @@ -842,6 +925,7 @@ Multiplies numbers or vectors. [Back to top.](#ludus-prelude-documentation) +--- ### neg Multiplies a number by -1, negating it. ``` @@ -850,6 +934,7 @@ Multiplies a number by -1, negating it. [Back to top.](#ludus-prelude-documentation) +--- ### neg? Returns true if a value is a negative number, otherwise returns false. ``` @@ -859,6 +944,7 @@ Returns true if a value is a negative number, otherwise returns false. [Back to top.](#ludus-prelude-documentation) +--- ### neq? Returns true if none of the arguments have the same value. ``` @@ -869,6 +955,7 @@ Returns true if none of the arguments have the same value. [Back to top.](#ludus-prelude-documentation) +--- ### nil? Returns true if a value is nil. ``` @@ -878,6 +965,7 @@ Returns true if a value is nil. [Back to top.](#ludus-prelude-documentation) +--- ### not Returns false if a value is truthy, true if a value is falsy. ``` @@ -888,6 +976,7 @@ Returns false if a value is truthy, true if a value is falsy. [Back to top.](#ludus-prelude-documentation) +--- ### odd? Returns true if a value is an odd number, otherwise returns false. ``` @@ -897,6 +986,7 @@ Returns true if a value is an odd number, otherwise returns false. [Back to top.](#ludus-prelude-documentation) +--- ### ok Takes a value and wraps it in an :ok result tuple. ``` @@ -905,6 +995,7 @@ Takes a value and wraps it in an :ok result tuple. [Back to top.](#ludus-prelude-documentation) +--- ### ok? Takes a value and returns true if it is an :ok result tuple. ``` @@ -914,6 +1005,7 @@ Takes a value and returns true if it is an :ok result tuple. [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. ``` @@ -925,6 +1017,7 @@ Returns true if any value passed in is truthy. Note that this does not short-cir [Back to top.](#ludus-prelude-documentation) +--- ### ordered? Returns true if a value is an indexed collection: list or tuple. ``` @@ -935,10 +1028,12 @@ Returns true if a value is an indexed collection: list or 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! ``` @@ -949,6 +1044,7 @@ Changes the turtle's pen color. Takes a single grayscale value, an rgb tuple, or [Back to top.](#ludus-prelude-documentation) +--- ### pd! Lowers the turtle's pen, causing it to draw. Alias: pd! ``` @@ -957,6 +1053,7 @@ 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. ``` @@ -965,6 +1062,7 @@ 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! ``` @@ -975,6 +1073,7 @@ Changes the turtle's pen color. Takes a single grayscale value, an rgb tuple, or [Back to top.](#ludus-prelude-documentation) +--- ### pendown! Lowers the turtle's pen, causing it to draw. Alias: pd! ``` @@ -983,6 +1082,7 @@ 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. ``` @@ -991,6 +1091,7 @@ 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! ``` @@ -999,6 +1100,7 @@ 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. ``` @@ -1007,6 +1109,7 @@ 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! ``` @@ -1015,10 +1118,12 @@ Sets the width of the turtle's pen, measured in pixels. Alias: pw! [Back to top.](#ludus-prelude-documentation) +--- ### pi No documentation available. +--- ### pos? Returns true if a value is a positive number, otherwise returns false. ``` @@ -1028,6 +1133,7 @@ Returns true if a value is a positive number, otherwise returns false. [Back to top.](#ludus-prelude-documentation) +--- ### position Returns the turtle's current position. ``` @@ -1036,6 +1142,7 @@ Returns the turtle's current position. [Back to top.](#ludus-prelude-documentation) +--- ### print! Sends a text representation of Ludus values to the console. ``` @@ -1044,6 +1151,7 @@ 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! ``` @@ -1052,6 +1160,7 @@ 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! ``` @@ -1060,6 +1169,7 @@ Sets the width of the turtle's pen, measured in pixels. Alias: pw! [Back to top.](#ludus-prelude-documentation) +--- ### rad/deg Converts an angle in radians to an angle in degrees. ``` @@ -1068,6 +1178,7 @@ Converts an angle in radians to an angle in degrees. [Back to top.](#ludus-prelude-documentation) +--- ### rad/turn Converts an angle in radians to an angle in turns. ``` @@ -1076,6 +1187,7 @@ Converts an angle in radians to an angle in turns. [Back to top.](#ludus-prelude-documentation) +--- ### random Returns a random number. 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 list, it returns a random member of that list. ``` @@ -1088,6 +1200,7 @@ Returns a random number. With zero arguments, returns a random number between 0 [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. ``` @@ -1097,6 +1210,7 @@ Returns a random integer. With one argument, returns a random integer between 0 [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. ``` @@ -1106,6 +1220,7 @@ Returns the set of integers between start (inclusive) and end (exclusive) as a l [Back to top.](#ludus-prelude-documentation) +--- ### render_turtle! No docstring available. ``` @@ -1114,6 +1229,7 @@ No docstring available. [Back to top.](#ludus-prelude-documentation) +--- ### report! Prints a value, then returns it. ``` @@ -1123,6 +1239,7 @@ Prints a value, then returns it. [Back to top.](#ludus-prelude-documentation) +--- ### reset_turtle! Resets the turtle to its original state. ``` @@ -1131,6 +1248,7 @@ 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. ``` @@ -1140,6 +1258,7 @@ Returns all but the first element of a list or tuple, as a list. [Back to top.](#ludus-prelude-documentation) +--- ### right! Rotates the turtle right, measured in turns. Alias: rt! ``` @@ -1148,6 +1267,7 @@ Rotates the turtle right, measured in turns. Alias: rt! [Back to top.](#ludus-prelude-documentation) +--- ### round Rounds a number to the nearest integer. ``` @@ -1156,6 +1276,7 @@ Rounds a number to the nearest integer. [Back to top.](#ludus-prelude-documentation) +--- ### rt! Rotates the turtle right, measured in turns. Alias: rt! ``` @@ -1164,6 +1285,7 @@ Rotates the turtle right, measured in turns. Alias: rt! [Back to top.](#ludus-prelude-documentation) +--- ### second Returns the second element of a list or tuple. ``` @@ -1172,6 +1294,7 @@ Returns the second element of a list or tuple. [Back to top.](#ludus-prelude-documentation) +--- ### sentence Takes a list of words and turns it into a sentence. ``` @@ -1180,6 +1303,7 @@ Takes a list of words and turns it into a sentence. [Back to top.](#ludus-prelude-documentation) +--- ### set Takes an ordered collection--list or tuple--and turns it into a set. ``` @@ -1189,6 +1313,7 @@ Takes an ordered collection--list or tuple--and turns it into a set. [Back to top.](#ludus-prelude-documentation) +--- ### set? Returns true if a value is a set. ``` @@ -1198,6 +1323,7 @@ Returns true if a value is a set. [Back to top.](#ludus-prelude-documentation) +--- ### show Returns a text representation of a Ludus value as a string. ``` @@ -1206,6 +1332,7 @@ Returns a text representation of a Ludus value as a string. [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. ``` @@ -1217,6 +1344,7 @@ Returns the sine of an angle. Default angle measure is turns. An optional keywor [Back to top.](#ludus-prelude-documentation) +--- ### slice Returns a slice of a list, representing a sub-list. ``` @@ -1228,6 +1356,7 @@ Returns a slice of a list, representing a sub-list. [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. ``` @@ -1237,6 +1366,7 @@ Takes a possibly nil value and a default value. Returns the value if it's not ni [Back to top.](#ludus-prelude-documentation) +--- ### some? Returns true if a value is not nil. ``` @@ -1246,6 +1376,7 @@ Returns true if a value is not nil. [Back to top.](#ludus-prelude-documentation) +--- ### split Takes a string, and turns it into a list of strings, breaking on the separator. ``` @@ -1254,6 +1385,7 @@ Takes a string, and turns it into a list of strings, breaking on the separator. [Back to top.](#ludus-prelude-documentation) +--- ### square Squares a number. ``` @@ -1262,10 +1394,12 @@ Squares a 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. ``` @@ -1274,6 +1408,7 @@ Stores a value in a box, replacing the value that was previously there. Returns [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. ``` @@ -1284,6 +1419,7 @@ Converts a value to a string by using `show`. If it is a string, returns it unha [Back to top.](#ludus-prelude-documentation) +--- ### string? Returns true if a value is a string. ``` @@ -1293,6 +1429,7 @@ Returns true if a value is a string. [Back to top.](#ludus-prelude-documentation) +--- ### strip Removes punctuation from a string, removing all instances of ,.;:?! ``` @@ -1307,6 +1444,7 @@ Removes punctuation from a string, removing all instances of ,.;:?! [Back to top.](#ludus-prelude-documentation) +--- ### sub Subtracts numbers or vectors. ``` @@ -1319,6 +1457,7 @@ Subtracts numbers or vectors. [Back to top.](#ludus-prelude-documentation) +--- ### sum_of_squares Returns the sum of squares of numbers. ``` @@ -1330,6 +1469,7 @@ Returns the sum of squares of numbers. [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. ``` @@ -1341,10 +1481,12 @@ Returns the sine of an angle. Default angle measure is turns. An optional keywor [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. ``` @@ -1355,6 +1497,7 @@ Trims whitespace from a string. Takes an optional argument, `:left` or `:right`, [Back to top.](#ludus-prelude-documentation) +--- ### tuple? Returns true if a value is a tuple. ``` @@ -1364,6 +1507,7 @@ Returns true if a value is a tuple. [Back to top.](#ludus-prelude-documentation) +--- ### turn/deg Converts an angle in turns to an angle in degrees. ``` @@ -1372,6 +1516,7 @@ Converts an angle in turns to an angle in degrees. [Back to top.](#ludus-prelude-documentation) +--- ### turn/rad Converts an angle in turns to an angle in radians. ``` @@ -1380,10 +1525,12 @@ Converts an angle in turns to an angle in radians. [Back to top.](#ludus-prelude-documentation) +--- ### turtle_commands No documentation available. +--- ### turtle_state Returns the turtle's current state. ``` @@ -1392,10 +1539,12 @@ 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. ``` @@ -1404,6 +1553,7 @@ Returns a keyword representing the type of the value passed in. [Back to top.](#ludus-prelude-documentation) +--- ### unbox Returns the value that is stored in a box. ``` @@ -1412,6 +1562,7 @@ Returns the value that is stored in a 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. ``` @@ -1422,6 +1573,7 @@ Takes a result tuple. If it's :ok, then returns the value. If it's not :ok, then [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. ``` @@ -1431,6 +1583,7 @@ Takes a value that is a result tuple and a default value. If it's :ok, then it r [Back to top.](#ludus-prelude-documentation) +--- ### upcase Takes a string and returns it in all uppercase. Works only for ascii characters. ``` @@ -1439,6 +1592,7 @@ Takes a string and returns it in all uppercase. Works only for ascii characters. [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. ``` @@ -1448,6 +1602,7 @@ Takes a dict, key, and function, and returns a new dict with the key set to the [Back to top.](#ludus-prelude-documentation) +--- ### update! Updates a box by applying a function to its value. Returns the new value. ``` @@ -1456,6 +1611,7 @@ Updates a box by applying a function to its value. Returns the new value. [Back to top.](#ludus-prelude-documentation) +--- ### values Takes a dict and returns a list of values in that dict. ``` @@ -1464,6 +1620,7 @@ Takes a dict and returns a list of values in that dict. [Back to top.](#ludus-prelude-documentation) +--- ### words Takes a string and returns a list of the words in the string. Strips all whitespace. ``` @@ -1472,6 +1629,7 @@ Takes a string and returns a list of the words in the string. Strips all whitesp [Back to top.](#ludus-prelude-documentation) +--- ### ws? Tells if a string is a whitespace character. ``` @@ -1483,6 +1641,7 @@ Tells if a string is a whitespace character. [Back to top.](#ludus-prelude-documentation) +--- ### zero? Returns true if a number is 0. ```