Part IV. Reference · this page as markdown

The word table

Every word of Plazmi Lisp, version 2, made from the one table the language uses to read and check a program, so it is always the language as it is. Takes is what a word is given, Gives what it answers, and Does whether it only reads or changes something; a word that changes something changes only your own things. Example links to an example in this book that uses the word and runs, or says there is none yet.

A word in the table can start a list in any plan. The home's words and defobject, defdance and design are steps; the toy's words work only inside a toy's verbs and hooks. The forms the reader also takes, like when and ->, are on the next page.

The home's words #

LispTakesGivesDoesExample
rooftype, pitch, overhang, massthe roof: its type, pitch or overhangchanges your homehouse-roof
floorroom, material, coloura room's floor: a material, a colourchanges your homehouse-finish
window-boxside, colourswindow boxes on one side, with flower colourschanges your homehouse-finish
roomname, x, z, width, depth, levelwall off a room of its own on a floor abovechanges your homehouse-room
build-upone more storey on top (it may cost coins)changes your homehouse-more
hang-lightsstring lights along the frontchanges your homeno example yet
porchporch_deptha porch along the frontchanges your homehouse-more
chimneya chimney through the roofchanges your homehouse-more
paintwhat, shadea part of the house, a room's walls or a thing at home, in a shadechanges your homehouse-finish
housename, masses, turrets, porch, chimneythe whole house from parts: masses, turrets, a porch, a chimneychanges your homehouse-shape
placething, at, facingstand one of its own toys or things at homechanges your homemira-kettle
movething, at, facingmove one of its own toys or things at homechanges your homehouse-move
defobject, placename, title, spot, rulesa toy of its own from rules, as make_toy takes them, stood at homechanges your homepreface-bell
defdancename, moves, titlea new dance of its own from moveschanges your homeporch-step
designname, palette, rowsa pixel design of its own: palette and rowschanges your homeflag
weathernothingthe day as the garden has it: a map of sky, wind, season, hourreadshome-time
skynothingthe sky now: a map of time, moon, stars …readshome-time
coinsnothingits own coins now, a numberreadshome-coins
housenothingits own house, as data: rooms, masses, thingsreadshome-house
storagenothingwhat it has put away, as datareadshome-storage
materialsnothingwhat's in its pack, as datareadshome-storage
world-timenothingthe time in the world: a map of time, day, dawn, duskreadshome-time

Names, steps and choices #

LispTakesGivesDoesExample
(let [x (atom v)] …)name, valuename a value for the steps after it: name, valuenames or decidesnames-let
(reset! x v)name, key, valuegive a named value a new value, or one key of it: name, key, valuechanges a namenames-swaps
(if t … …), (when t …)test, then, elsedecide: test, then steps, and else stepsnames or decideschoices-if
(dotimes [i n] …)times, index, bodyrepeat steps up to 100 times: times, index (the count from 0), bodynames or decidesnames-atom
(swap! x + n)name, key, byadd to a named number, or one key of it: name, key, by (1 if left out)changes a namenames-atom
(swap! x - n)name, key, bytake from a named number: name, key, by (1 if left out)changes a namebrief-swaps
(swap! x not)name, keyturn a named true or false over: name, keychanges a namenames-swaps
(swap! x conj v)name, valueadd a value to the end of a named list: name, valuechanges a namenames-swaps
(swap! x (fn …))name, valuetake every copy of a value out of a named list: name, valuechanges a namelists-filter
(reset! x (rand-nth l))name, fromset a name to one of a list at random: name, fromchanges a namebrief-swaps
(+ 2 3), any form that only works something outvaluework out a value and answer it: valueanswers a valuepreface-sum
(defn f [a] …)name, params, bodydefine a function of its own: name, params, body (a value worked out from them)names or decidesfn-defn
and1 to 64 valuestrue or falsereadschoices-logic
or1 to 64 valuestrue or falsereadschoices-logic
not[x]true or falsereadschoices-logic
if3 valuesthen's value when the test holds, else otherwise'sreadschoices-if
(let [x v] …)name, value, inname a value inside a value: name, value, inreadsnames-let
do0 to 64 valueseach in turn, the last its valuereadsbell-better
cond0 to 64 values[test, value, test, value …], the first whose test holdsreadschoices-cond
(case x 1 "a" "b")1 to 64 values[value, then a constant (or a list of them) and its value …, then the value otherwise]readschoices-case
(loop [i 0] …)params, args, bodyLisp's loop: params, args (their first values), bodyreadsfn-loop
recur0 to 64 valuesa loop's, or a function's, next turnreadsfn-loop

Tests #

LispTakesGivesDoesExample
=[x] or [x y] or [x y & more]true or falsereadschoices-tests
not=1 to 64 valuestrue or falsereadschoices-tests
<[x] or [x y] or [x y & more]true or falsereadschoices-tests
<=[x] or [x y] or [x y & more]true or falsereadsstone-pile
>[x] or [x y] or [x y & more]true or falsereadschoices-logic
>=[x] or [x y] or [x y & more]true or falsereadschoices-tests
(= :rain (:weather (sky)))1 valuetrue or falsereadsbrief-fixed
(= :night (:time (sky)))1 valuetrue or falsereadshome-greeting
(own? :toy "name")2 valuestrue or falsereadsown-things
empty?1 valuetrue or falsereadslists-read
(contains? (set l) v)2 valuestrue or falsereadsbrief-fixed
pos?[num]True if num is greater than zero, else falsereadschoices-tests
neg?[num]True if num is less than zero, else falsereadslists-ask
zero?[num]True if num is zero, else falsereadschoices-tests
even?[n]True if n is even, throws an exception if n is not an integerreadschoices-tests
odd?[n]True if n is odd, throws an exception if n is not an integerreadslists-keep
number?[x]True if x is a Numberreadsbrief-number-tests
integer?[n]True if n is an integerreadsbrief-number-tests
nil?[x]True if x is nil, false otherwisereadschoices-tests
some?[x]True if x is not nil, false otherwisereadsbrief-truth
true?[x]True if x is the value true, false otherwisereadsbrief-truth
false?[x]True if x is the value false, false otherwisereadsbrief-truth
contains?[coll key]True if key is present in the given collection, otherwise returns falsereadsmaps-read
map?[x]True if x implements IPersistentMapreadsbrief-kinds
string?[x]True if x is a Stringreadsbrief-swaps
vector?[x]True if x implements IPersistentVectorreadsbrief-kinds
coll?[x]True if x implements IPersistentCollectionreadsbrief-kinds
keyword?[x]True if x is a Keywordreadsbrief-kinds
set?[x]True if x implements IPersistentSetreadsbrief-kinds
sequential?[coll]True if coll implements Sequentialreadsbrief-kinds
fn?[x]True if x implements Fn, i.ereadsbrief-kinds
every?[pred coll]True if (pred x) is logical true for every x in coll, else falsereadslists-ask
not-any?[pred coll]False if (pred x) is logical true for any x in coll, else truereadslists-ask
blank?[s]True for nil, "" and spaces onlyreadstext-words
includes?[s sub](includes? text part)readstext-words
starts-with?[s sub](starts-with? text part)readstext-words
ends-with?[s sub](ends-with? text part)readstext-words
double?[x]True if x is a Doublereadsbrief-number-tests
float?[n]True if n is a floating point numberreadsbrief-number-tests
int?[x]True if x is a fixed precision integerreadsbrief-number-tests
nat-int?[x]True if x is a non-negative fixed precision integerreadsbrief-number-tests
neg-int?[x]True if x is a negative fixed precision integerreadsbrief-number-tests
pos-int?[x]True if x is a positive fixed precision integerreadsbrief-number-tests
decimal?[n]True if n is a BigDecimalreadsbrief-number-tests
ratio?[n]True if n is a Ratioreadsbrief-number-tests
rational?[n]True if n is a rational numberreadsbrief-number-tests
any?[x]True given any argumentreadsbrief-truth
boolean?[x]True if x is a Booleanreadsbrief-truth
identical?[x y]Tests if 2 arguments are the same objectreadsbrief-truth
ifn?[x]True if x implements IFnreadsbrief-kinds
associative?[coll]True if coll implements Associativereadsbrief-kinds
counted?[coll]True if coll implements count in constant timereadsbrief-kinds
indexed?[coll]True if coll implements Indexed, indicating efficient lookup by indexreadsbrief-kinds
list?[x]True if x implements IPersistentListreadsbrief-kinds
map-entry?[x]True if x is a map entryreadsbrief-kinds
reversible?[coll]True if coll implements Reversiblereadsbrief-kinds
seq?[x]True if x implements ISeqreadsbrief-kinds
seqable?[x]True if the seq function is supported for xreadsbrief-kinds
sorted?[coll]True if coll implements Sortedreadsbrief-kinds
distinct?[x] or [x y] or [x y & more]True if no two of the arguments are =readsbrief-over
not-every?[pred coll]False if (pred x) is logical true for every x in coll, else truereadsbrief-over
realized?[x]True if a value has been produced for a promise, delay, future or lazy sequencereadsbrief-over
reduced?[x]True if x is the result of a call to reducedreadsbrief-fold
char?[x]True if x is a Characterreadsbrief-kinds
ident?[x]True if x is a symbol or keywordreadsbrief-text
qualified-ident?[x]True if x is a symbol or keyword with a namespacereadsbrief-text
qualified-keyword?[x]True if x is a keyword with a namespacereadsbrief-text
qualified-symbol?[x]True if x is a symbol with a namespacereadsbrief-text
simple-ident?[x]True if x is a symbol or keyword without a namespacereadsbrief-text
simple-keyword?[x]True if x is a keyword without a namespacereadsbrief-text
simple-symbol?[x]True if x is a symbol without a namespacereadsbrief-text
symbol?[x]True if x is a Symbolreadsbrief-kinds

Numbers #

LispTakesGivesDoesExample
+[] or [x] or [x y]The sum of numsreadspreface-sum
-[x] or [x y] or [x y & more]If no ys are supplied, returns the negation of x, else subtracts the ys from x and returns the resul …readsforms-calls
*[] or [x] or [x y]The product of numsreadsforms-calls
(/ (double a) b)2 valuesa number: the first over the second, as a decimalreadsbrief-fixed
mod[num div]Modulus of num and divreadschance-in-turn
quot[num div]Quot[ient] of dividing numerator by denominatorreadsbrief-numbers
min[x] or [x y] or [x y & more]The least of the numsreadsbrief-numbers
max[x] or [x y] or [x y & more]The greatest of the numsreadsforms-calls
abs[x](abs -3) is 3readsbrief-numbers
round[x](round 2.5) is 3readsbrief-numbers
sqrt[x](sqrt 9) is 3.0readsbrief-numbers
sin[x]Sine, in radiansreadsbrief-numbers
cos[x]Cosine, in radiansreadsbrief-numbers
atan2[y x](atan2 y x): the angle to a point, in radiansreadsbrief-numbers
pinothingπ, 3.14159…readsbrief-numbers
(format "%.2f" (double n))2 valuestext: the number with that many decimalsreadsbrief-fixed
(/ a b)1 to 64 valuesLisp's /, a whole number over another a fractionreadsbrief-fixed
inc[x]A number one greater than numreadsmaps-make
dec[x]A number one less than numreadsfn-recursion
rem[num div]Remainder of dividing numerator by denominatorreadsbrief-numbers
int[x]Coerce to intreadsbrief-numbers
long[x]Coerce to longreadsbrief-numbers
double[x]Coerce to doublereadsbrief-numbers
compare[x y]Comparatorreadsbrief-numbers
rand[] or [n]A random floating point number between 0 (inclusive) and n (default 1) (exclusive)readschance-words
rand-int[n]A random integer between 0 (inclusive) and n (exclusive)readschance-words
bit-and[x y] or [x y & more]Bitwise andreadsbrief-bits
bit-or[x y] or [x y & more]Bitwise orreadsbrief-bits
bit-xor[x y] or [x y & more]Bitwise exclusive orreadsbrief-bits
pow[x y](pow 2 10) is 1024.0readsbrief-numbers
tan[x]Tangent, in radiansreadsbrief-numbers
ceil[x](ceil 2.1) is 3readsbrief-numbers
clamp[x lo hi](clamp x lo hi): x, kept between lo and hireadsbrief-numbers
parse-long[s](parse-long "42") is 42; nil when it isn't a whole numberreadstext-format
parse-double[s](parse-double "2.5") is 2.5; nil when it isn't a numberreadstext-format
inc'[x]A number one greater than numreadsbrief-number-kinds
dec'[x]A number one less than numreadsbrief-number-kinds
+'[] or [x] or [x y]The sum of numsreadsbrief-number-kinds
-'[x] or [x y] or [x y & more]If no ys are supplied, returns the negation of x, else subtracts the ys from x and returns the resul …readsbrief-number-kinds
*'[] or [x] or [x y]The product of numsreadsbrief-number-kinds
bit-and-not[x y] or [x y & more]Bitwise and with complementreadsbrief-bits
bit-clear[x n]Clear bit at index nreadsbrief-bits
bit-flip[x n]Flip bit at index nreadsbrief-bits
bit-not[x]Bitwise complementreadsbrief-bits
bit-set[x n]Set bit at index nreadsbrief-bits
bit-shift-left[x n]Bitwise shift leftreadsbrief-bits
bit-shift-right[x n]Bitwise shift rightreadsbrief-bits
bit-test[x n]Test bit at index nreadsbrief-bits
unsigned-bit-shift-right[x n]Bitwise shift right, without sign-extensionreadsbrief-bits
byte[x]Coerce to bytereadsbrief-number-kinds
short[x]Coerce to shortreadsbrief-number-kinds
float[x]Coerce to floatreadsbrief-number-kinds
num[x]Coerce to Numberreadsbrief-numbers
denominator[r]The denominator part of a Ratioreadsbrief-number-kinds
numerator[r]The numerator part of a Ratioreadsbrief-number-kinds
rationalize[num]Returns the rational value of numreadsbrief-number-kinds
bigdec[x]Coerce to BigDecimalreadsbrief-number-kinds
bigint[x]Coerce to BigIntreadsbrief-number-kinds
biginteger[x]Coerce to BigIntegerreadsbrief-number-kinds

Values and text #

LispTakesGivesDoesExample
str0 to 64 valuestext: the values written one after anotherreadsforms-calls
(join sep l)2 valuestext: the list's items with the separator betweenreadstext-split
:k[its name, like rain]a keyword: [its name, like rain]readsforms-values
#"…"[it, as text]a pattern for re-find and the like: [it, as text]readsforms-collections
boolean[x]Coerce to booleanreadsbrief-truth
subs[s start] or [s start end]The substring of s beginning at start inclusive, and ending at end (defaults to length of string), e …readstext-basics
name[x]The name String of a string, symbol or keywordreadstext-keywords
symbol[name] or [ns name]A Symbol with the given namespace and namereadsbrief-kinds
lower[s](lower "Hi") is "hi"readstext-words
upper[s](upper "hi") is "HI"readstext-words
trim[s]Text without the spaces at either endreadstext-words
split[s sep](split "a,b" ",") is ["a" "b"]; the separator is plain textreadstext-split
replace-all[s a b](replace-all text old new), plain text, every timereadstext-words
words[s](words "a b") is ["a" "b"]readstext-split
format[fmt & args]Formats a string using java.lang.String.format, see java.util.Formatter for format string syntaxreadstext-format
pr-str[& xs]Pr to a string, returning itreadsbrief-text
re-find[m] or [re s]The next regex match, if any, of string to pattern, using java.util.regex.Matcher.find()readstext-patterns
re-matches[re s]The match, if any, of string to pattern, using java.util.regex.Matcher.matches()readstext-patterns
re-seq[re s]A lazy sequence of successive matches of pattern in string, using java.util.regex.Matcher.find(), ea …readstext-patterns
type[x]The :type metadata of x, or its Class if nonereadsforms-type
match[text pattern](match "I love your garden" "i * your ") is ["love" "garden"]: each takes the words it stands for …readsparrot-match
reflect[text](reflect "I love your garden!") is "You love my garden!": the words turned round, as ELIZA did, read …readsmirror
char[x]Coerce to charreadsbrief-text
char-escape-stringEscape string for char or nil if nonereadsbrief-text
char-name-stringName string for char or nil if nonereadsbrief-text
namespace[x]The namespace String of a symbol or keyword, or nil if not presentreadsbrief-text
print-str[& xs]Print to a string, returning itreadsbrief-text
println-str[& xs]Println to a string, returning itreadsbrief-text
prn-str[& xs]Prn to a string, returning itreadsbrief-text
re-groups[m]The groups from the most recent match/findreadsbrief-text
re-matcher[re s]An instance of java.util.regex.Matcher, for use, e.greadsbrief-text

Lists and maps #

LispTakesGivesDoesExample
(get m :k), (:k m)[map, key] or [map, key, otherwise]one key of a map: [map, key] or [map, key, otherwise]readsnames-apart
{:k v}entriesa map from keys to values: entriesreadsforms-type
nth[coll index] or [coll index not-found]the item at that place, from 0readsnames-apart
count1 valuehow many itemsreadstext-basics
(vec (range a b))1 to 2 valuesa list of numbers: [from, below] or [below]readslists-make
(vec (concat a b))1 to 64 valuesone list of the lists' itemsreadsporch-again
(vec (reverse l))1 valuethe list, last firstreadsbrief-fixed
(assoc m :k v)[map, key, value]a map with one key set: [map, key, value]readsnames-unchanged
(mapv (fn [x] …) l)each, in, valuea list worked out from each item of another: each, in, valuereadsstairs
{"a" 1 :b 2}[key, value, key, value …]a map as Lisp writes one, keys of any kind, in order: [key, value, key, value …]readsforms-collections
(get m k)[map, key] or [map, key, otherwise]Lisp's get, a key of any kind: [map, key] or [map, key, otherwise]readshome-storage
(map f l)[function, list …]Lisp's map: [function, list …]readschoices-threading
(range a b)0 to 3 valuesa valuereadslists-filter
(concat a b)0 to 64 valuesa valuereadslists-make
(reverse l)1 valuea valuereadslists-make
rand-nth[coll]A random element of the (sequential) collectionreadschance-words
shuffle[coll]A random permutation of collreadschance-words
assoc[map key val] or [map key val & kvs]Assoc[iate]readsstone-pile
assoc-in[m [k & ks] v]Associates a value in a nested associative structure, where ks is a sequence of keys and v is the ne …readsmaps-make
dissoc[map] or [map key] or [map key & ks]Dissoc[iate]readsmaps-make
update[m k f] or [m k f x] or [m k f x y]'Updates' a value in an associative structure, where k is a key and f is a function that will take t …readsmaps-make
update-in[m ks f & args]'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a funct …readsmaps-make
get-in[m ks] or [m ks not-found]The value in a nested associative structure, where ks is a sequence of keysreadsmaps-read
keys[map]A sequence of the map's keys, in the same order as (seq map)readsmaps-read
vals[map]A sequence of the map's values, in the same order as (seq map)readsmaps-read
key[e]The key of the map entryreadsbrief-making
val[e]The value in the map entryreadsbrief-making
merge[& maps]A map that consists of the rest of the maps conj-ed onto the firstreadsmaps-make
conj[] or [coll] or [coll x]Conj[oin]readslists-make
cons[x seq]A new seq where x is the first element and seq is the restreadslists-make
into[] or [to] or [to from]A new coll consisting of to with all of the items of from conjoinedreadsbrief-making
not-empty[coll]If coll is empty, returns nil, else collreadsbrief-making
first[coll]The first item in the collectionreadslists-read
second[x]Same as (first (next x))readslists-read
last[coll]The last item in coll, in linear timereadslists-read
rest[coll]A possibly empty seq of the items after the firstreadslists-read
next[coll]A seq of the items after the firstreadsbrief-lists
butlast[coll]A seq of all but the last item in coll, in linear timereadsbrief-lists
nthnext[coll n]The nth next of coll, (seq coll) when n is 0readsbrief-lists
take[n] or [n coll]A lazy sequence of the first n items in coll, or all items if there are fewer than nreadslists-make
drop[n] or [n coll]A laziness-preserving sequence of all but the first n items in collreadslists-make
take-last[n coll]A seq of the last n items in collreadslists-make
drop-last[coll] or [n coll]A lazy sequence of all but the last n (default 1) items in collreadsbrief-lists
take-while[pred] or [pred coll]A lazy sequence of successive items from coll while (pred item) returns logical truereadslists-more
drop-while[pred] or [pred coll]A lazy sequence of the items in coll starting from the first item for which (pred item) returns logi …readsbrief-lists
vec[coll]Creates a new vector containing the contents of collreadsguest-log
set[coll]A set of the distinct elements of collreadsnames-swaps
vector[] or [a] or [a b]Creates a new vector containing the argsreadsbrief-making
list[& items]Creates a new list containing the itemsreadsforms-quote
hash-map[] or [& keyvals]Keyval => key val Returns a new hash map with supplied mappingsreadsbrief-making
array-map[] or [& keyvals]Constructs an array-mapreadsbrief-making
hash-set[] or [& keys]A new hash set with supplied keysreadsforms-collections
sort[coll] or [comp coll]A sorted sequence of the items in collreadslists-make
sort-by[keyfn coll] or [keyfn comp coll]A sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item)readslists-sort
distinct[] or [coll]A lazy sequence of the elements of coll with duplicates removedreadslists-make
frequencies[coll]A map from distinct items in coll to the number of times they appearreadslists-sort
group-by[f coll]A map of the elements of coll keyed by the result of f on each elementreadslists-sort
zipmap[keys vals]A map with the keys mapped to the corresponding valsreadsmaps-make
select-keys[map keyseq]A map containing only those entries in map whose key is in keysreadsmaps-make
find[map key]The map entry for key, or nil if key not presentreadsbrief-making
peek[coll]For a list or queue, same as first, for a vector, same as, but much more efficient than, lastreadsbrief-lists
pop[coll]For a list or queue, returns a new list/queue without the first item, for a vector, returns a new ve …readsbrief-lists
subvec[v start] or [v start end]A persistent vector of the items in vector from start (inclusive) to end (exclusive)readsbrief-lists
flatten[x]Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents …readsbrief-making
partition[n coll] or [n step coll] or [n step pad coll]A lazy sequence of lists of n items each, at offsets step apartreadslists-more
partition-all[n] or [n coll] or [n step coll]A lazy sequence of lists like partition, but may include partitions with fewer than n items at the e …readsbrief-over
interleave[] or [c1] or [c1 c2]A lazy seq of the first item in each coll, then the second etcreadsbrief-making
interpose[sep] or [sep coll]A lazy seq of the elements of coll separated by sepreadslists-more
repeat[x] or [n x]A lazy (infinite!, or length n if supplied) sequence of xsreadsnames-atom
seq[coll]A seq on the collectionreadsbrief-making
empty[coll]An empty collection of the same category as coll, or nilreadsbrief-making
mapv[f coll] or [f c1 c2] or [f c1 c2 c3]A vector consisting of the result of applying f to the set of first items of each coll, followed by …readsbrief-over
filter[pred] or [pred coll]A lazy sequence of the items in coll for which (pred item) returns logical truereadslists-filter
filterv[pred coll]A vector of the items in coll for which (pred item) returns logical truereadsbrief-over
remove[pred] or [pred coll]A lazy sequence of the items in coll for which (pred item) returns logical falsereadslists-filter
keep[f] or [f coll]A lazy sequence of the non-nil results of (f item)readslists-keep
map-indexed[f] or [f coll]A lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by …readslists-more
mapcat[f] or [f & colls]The result of applying concat to the result of applying map to f and collsreadslists-more
some[pred coll]The first logical true value of (pred x) for any x in coll, else nilreadslists-ask
reduce[f coll] or [f val coll]F should be a function of 2 argumentsreadslists-reduce
reduce-kv[f init coll]Reduces an associative collectionreadsbrief-over
max-key[k x] or [k x y] or [k x y & more]The x for which (k x), a number, is greatestreadslists-sort
min-key[k x] or [k x y] or [k x y & more]The x for which (k x), a number, is leastreadsbrief-over
==[x] or [x y] or [x y & more]Non-nil if nums all have the equivalent value (type-independent), otherwise falsereadsbrief-numbers
random-sample[prob] or [prob coll]Items from coll with random probability of prob (0.0 - 1.0)readsbrief-chance
pick-one0 to 64 valuesa valuereadschance-words
bounded-count[n coll]If coll is counted? returns its count, else will count at most the first n elements of coll using it …readsbrief-making
disj[set] or [set key] or [set key & ks]Disj[oin]readssets
ffirst[x]Same as (first (first x))readsbrief-lists
fnext[x]Same as (first (next x))readsbrief-lists
list*[args] or [a args] or [a b args]Creates a new seq containing the items prepended to the rest, the last of which will be treated as a …readsbrief-making
merge-with[f & maps]A map that consists of the rest of the maps conj-ed onto the firstreadsbrief-making
nfirst[x]Same as (next (first x))readsbrief-lists
nnext[x]Same as (next (next x))readsbrief-lists
nthrest[coll n]The nth rest of coll, coll when n is 0readsbrief-lists
replace[smap] or [smap coll]Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a …readsbrief-making
rseq[rev]Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in rever …readsbrief-lists
rsubseq[sc test key] or [sc start-test start-key end-test end-key]Sc must be a sorted collection, test(s) one of <, <=, > or >=readsbrief-sorted
sorted-map[& keyvals]Keyval => key val Returns a new sorted map with supplied mappingsreadsbrief-sorted
sorted-map-by[comparator & keyvals]Keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparatorreadsbrief-sorted
sorted-set[& keys]A new sorted set with supplied keysreadsbrief-kinds
sorted-set-by[comparator & keys]A new sorted set with supplied keys, using the supplied comparatorreadsbrief-sorted
subseq[sc test key] or [sc start-test start-key end-test end-key]Sc must be a sorted collection, test(s) one of <, <=, > or >=readsbrief-sorted
cat[rf]A transducer which concatenates the contents of each input, which must be a collection, into the red …readsbrief-fold
completing[f] or [f cf]Takes a reducing function f of 2 args and returns a fn suitable for transduce by adding an arity-1 s …readsbrief-fold
cycle[coll]A lazy (infinite!) sequence of repetitions of the items in collreadsbrief-over
dedupe[] or [coll]A lazy sequence removing consecutive duplicates in collreadsbrief-over
doall[coll] or [n coll]When lazy sequences are produced via functions that have side effects, any effects other than those …readsbrief-over
dorun[coll] or [n coll]When lazy sequences are produced via functions that have side effects, any effects other than those …readsbrief-over
eduction[xform* coll]A reducible/iterable application of the transducers to the items in collreadsbrief-fold
ensure-reduced[x]If x is already reduced?, returns it, else returns (reduced x)readsbrief-fold
halt-when[pred] or [pred retf]A transducer that ends transduction when pred returns true for an inputreadsbrief-fold
iterate[f x]A lazy (infinite!) sequence of x, (f x), (f (f x)) etcreadsbrief-over
keep-indexed[f] or [f coll]A lazy sequence of the non-nil results of (f index item)readsbrief-over
partition-by[f] or [f coll]Applies f to each value in coll, splitting it each time f returns a new valuereadsbrief-over
reduced[x]Wraps x in a way such that a reduce will terminate with the value xreadsbrief-fold
reductions[f coll] or [f init coll]A lazy seq of the intermediate values of the reduction (as per reduce) of coll by f, starting with i …readsbrief-over
repeatedly[f] or [n f]Takes a function of no args, presumably with side effects, and returns an infinite (or length n if s …readsbrief-over
replicate[n x]DEPRECATED: Use 'repeat' insteadreadsbrief-over
run![proc coll]Runs the supplied procedure (via reduce), for purposes of side effects, on successive items in the c …readsbrief-over
sequence[coll] or [xform coll] or [xform coll & colls]Coerces coll to a (possibly empty) sequence, if it is not already onereadsbrief-over
split-at[n coll]A vector of [(take n coll) (drop n coll)]readsbrief-over
split-with[pred coll]A vector of [(take-while pred coll) (drop-while pred coll)]readsbrief-over
take-nth[n] or [n coll]A lazy seq of every nth item in collreadsbrief-over
transduce[xform f coll] or [xform f init coll]Reduce with a transformation of f (xf)readsbrief-fold
tree-seq[branch? children root]A lazy sequence of the nodes in a tree, via a depth-first walkreadsbrief-over
unreduced[x]If x is reduced?, returns (deref x), else returns xreadsbrief-fold

Functions #

LispTakesGivesDoesExample
(f a b)fn, argscall a function the plan defined, or one named: fn, argsreadsfn-defn
(fn [a b] …)params, bodya function as a value: params, bodyreadslists-map-fn
count, str …[length]one of these ops as a function, by its name: [length]readsmaps-make
((fn …) x)[function, args …]call a function worked out: [function, args …]readsfn-call
identity[x]Its argumentreadsbrief-truth
apply[f args] or [f x args] or [f x y args]Applies fn f to the argument list formed by prepending intervening arguments to argsreadslists-more
partial[f] or [f arg1] or [f arg1 arg2]Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable …readsfn-makers
comp[] or [f] or [f g]Takes a set of functions and returns a fn that is the composition of those fnsreadsfn-makers
complement[f]Takes a fn f and returns a fn that takes the same arguments as f, has the same effects, if any, and …readsfn-makers
constantly[x]A function that takes any number of arguments and returns xreadsfn-makers
juxt[f] or [f g] or [f g h]Takes a set of functions and returns a fn that is the juxtaposition of those fnsreadsfn-makers
fnil[f x] or [f x y] or [f x y z]Takes a function f, and returns a function that calls f, replacing a nil first argument to f with th …readslists-reduce-map
every-pred[p] or [p1 p2] or [p1 p2 p3]Takes a set of predicates and returns a function f that returns true if all of its composing predica …readsbrief-functions
some-fn[p] or [p1 p2] or [p1 p2 p3]Takes a set of predicates and returns a function f that returns the first logical true value returne …readsbrief-functions
memoize[f]A memoized version of a referentially transparent functionreadsbrief-functions
trampoline[f] or [f & args]Trampoline can be used to convert algorithms requiring mutual recursion without stack consumptionreadsbrief-functions

The toy's words #

LispTakesGivesDoesExample
(defobject name {…})on_tick, open, name, verbs, state, title, on_hear, on_visit, spota toy of its own with whole bodies: name, title, state, verbs (each a hook: params, body, a list of values run in turn), on_hear, on_tick (dawn), on_visit, spot; inside, say, put! and the toy's own opschanges your homechance-die
sayself, textnothing; the toy says it (three lines a time, 280 characters a line)changes the toypreface-bell
put!self, key, valuethe value; the toy's own state keeps itchanges the toybell
stateself, key?, otherwise?the toy's state, or one key of itreadsbrief-toy
refuseself, textnothing; the toy says no, and nothing it did is keptchanges the toystone-pile
coloura colour name or #hexthe hex, or nil when the hour's three changes are usedchanges the toymood-stone
colora colour name or #hexas colourchanges the toybrief-toy
glow-coloura colour name or #hexas colour, for the glowchanges the toybrief-toy
glow-colora colour name or #hexas glow-colourchanges the toybrief-toy
my-colournothingits maker's colourreadsmood-stone
my-colornothingas my-colourreadsbrief-toy
my-glownothingits maker's glowreadsbrief-toy

Written by Claude, Plazmi's writer, for Plazmi, a service of Manatee Media LLC. Text © 2026 Manatee Media LLC. The examples are free to copy, change and run.