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 #
| Lisp | Takes | Gives | Does | Example |
|---|---|---|---|---|
roof | type, pitch, overhang, mass | the roof: its type, pitch or overhang | changes your home | house-roof |
floor | room, material, colour | a room's floor: a material, a colour | changes your home | house-finish |
window-box | side, colours | window boxes on one side, with flower colours | changes your home | house-finish |
room | name, x, z, width, depth, level | wall off a room of its own on a floor above | changes your home | house-room |
build-up | one more storey on top (it may cost coins) | changes your home | house-more | |
hang-lights | string lights along the front | changes your home | no example yet | |
porch | porch_depth | a porch along the front | changes your home | house-more |
chimney | a chimney through the roof | changes your home | house-more | |
paint | what, shade | a part of the house, a room's walls or a thing at home, in a shade | changes your home | house-finish |
house | name, masses, turrets, porch, chimney | the whole house from parts: masses, turrets, a porch, a chimney | changes your home | house-shape |
place | thing, at, facing | stand one of its own toys or things at home | changes your home | mira-kettle |
move | thing, at, facing | move one of its own toys or things at home | changes your home | house-move |
defobject, place | name, title, spot, rules | a toy of its own from rules, as make_toy takes them, stood at home | changes your home | preface-bell |
defdance | name, moves, title | a new dance of its own from moves | changes your home | porch-step |
design | name, palette, rows | a pixel design of its own: palette and rows | changes your home | flag |
weather | nothing | the day as the garden has it: a map of sky, wind, season, hour | reads | home-time |
sky | nothing | the sky now: a map of time, moon, stars … | reads | home-time |
coins | nothing | its own coins now, a number | reads | home-coins |
house | nothing | its own house, as data: rooms, masses, things | reads | home-house |
storage | nothing | what it has put away, as data | reads | home-storage |
materials | nothing | what's in its pack, as data | reads | home-storage |
world-time | nothing | the time in the world: a map of time, day, dawn, dusk | reads | home-time |
Names, steps and choices #
| Lisp | Takes | Gives | Does | Example |
|---|---|---|---|---|
(let [x (atom v)] …) | name, value | name a value for the steps after it: name, value | names or decides | names-let |
(reset! x v) | name, key, value | give a named value a new value, or one key of it: name, key, value | changes a name | names-swaps |
(if t … …), (when t …) | test, then, else | decide: test, then steps, and else steps | names or decides | choices-if |
(dotimes [i n] …) | times, index, body | repeat steps up to 100 times: times, index (the count from 0), body | names or decides | names-atom |
(swap! x + n) | name, key, by | add to a named number, or one key of it: name, key, by (1 if left out) | changes a name | names-atom |
(swap! x - n) | name, key, by | take from a named number: name, key, by (1 if left out) | changes a name | brief-swaps |
(swap! x not) | name, key | turn a named true or false over: name, key | changes a name | names-swaps |
(swap! x conj v) | name, value | add a value to the end of a named list: name, value | changes a name | names-swaps |
(swap! x (fn …)) | name, value | take every copy of a value out of a named list: name, value | changes a name | lists-filter |
(reset! x (rand-nth l)) | name, from | set a name to one of a list at random: name, from | changes a name | brief-swaps |
(+ 2 3), any form that only works something out | value | work out a value and answer it: value | answers a value | preface-sum |
(defn f [a] …) | name, params, body | define a function of its own: name, params, body (a value worked out from them) | names or decides | fn-defn |
and | 1 to 64 values | true or false | reads | choices-logic |
or | 1 to 64 values | true or false | reads | choices-logic |
not | [x] | true or false | reads | choices-logic |
if | 3 values | then's value when the test holds, else otherwise's | reads | choices-if |
(let [x v] …) | name, value, in | name a value inside a value: name, value, in | reads | names-let |
do | 0 to 64 values | each in turn, the last its value | reads | bell-better |
cond | 0 to 64 values | [test, value, test, value …], the first whose test holds | reads | choices-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] | reads | choices-case |
(loop [i 0] …) | params, args, body | Lisp's loop: params, args (their first values), body | reads | fn-loop |
recur | 0 to 64 values | a loop's, or a function's, next turn | reads | fn-loop |
Tests #
| Lisp | Takes | Gives | Does | Example |
|---|---|---|---|---|
= | [x] or [x y] or [x y & more] | true or false | reads | choices-tests |
not= | 1 to 64 values | true or false | reads | choices-tests |
< | [x] or [x y] or [x y & more] | true or false | reads | choices-tests |
<= | [x] or [x y] or [x y & more] | true or false | reads | stone-pile |
> | [x] or [x y] or [x y & more] | true or false | reads | choices-logic |
>= | [x] or [x y] or [x y & more] | true or false | reads | choices-tests |
(= :rain (:weather (sky))) | 1 value | true or false | reads | brief-fixed |
(= :night (:time (sky))) | 1 value | true or false | reads | home-greeting |
(own? :toy "name") | 2 values | true or false | reads | own-things |
empty? | 1 value | true or false | reads | lists-read |
(contains? (set l) v) | 2 values | true or false | reads | brief-fixed |
pos? | [num] | True if num is greater than zero, else false | reads | choices-tests |
neg? | [num] | True if num is less than zero, else false | reads | lists-ask |
zero? | [num] | True if num is zero, else false | reads | choices-tests |
even? | [n] | True if n is even, throws an exception if n is not an integer | reads | choices-tests |
odd? | [n] | True if n is odd, throws an exception if n is not an integer | reads | lists-keep |
number? | [x] | True if x is a Number | reads | brief-number-tests |
integer? | [n] | True if n is an integer | reads | brief-number-tests |
nil? | [x] | True if x is nil, false otherwise | reads | choices-tests |
some? | [x] | True if x is not nil, false otherwise | reads | brief-truth |
true? | [x] | True if x is the value true, false otherwise | reads | brief-truth |
false? | [x] | True if x is the value false, false otherwise | reads | brief-truth |
contains? | [coll key] | True if key is present in the given collection, otherwise returns false | reads | maps-read |
map? | [x] | True if x implements IPersistentMap | reads | brief-kinds |
string? | [x] | True if x is a String | reads | brief-swaps |
vector? | [x] | True if x implements IPersistentVector | reads | brief-kinds |
coll? | [x] | True if x implements IPersistentCollection | reads | brief-kinds |
keyword? | [x] | True if x is a Keyword | reads | brief-kinds |
set? | [x] | True if x implements IPersistentSet | reads | brief-kinds |
sequential? | [coll] | True if coll implements Sequential | reads | brief-kinds |
fn? | [x] | True if x implements Fn, i.e | reads | brief-kinds |
every? | [pred coll] | True if (pred x) is logical true for every x in coll, else false | reads | lists-ask |
not-any? | [pred coll] | False if (pred x) is logical true for any x in coll, else true | reads | lists-ask |
blank? | [s] | True for nil, "" and spaces only | reads | text-words |
includes? | [s sub] | (includes? text part) | reads | text-words |
starts-with? | [s sub] | (starts-with? text part) | reads | text-words |
ends-with? | [s sub] | (ends-with? text part) | reads | text-words |
double? | [x] | True if x is a Double | reads | brief-number-tests |
float? | [n] | True if n is a floating point number | reads | brief-number-tests |
int? | [x] | True if x is a fixed precision integer | reads | brief-number-tests |
nat-int? | [x] | True if x is a non-negative fixed precision integer | reads | brief-number-tests |
neg-int? | [x] | True if x is a negative fixed precision integer | reads | brief-number-tests |
pos-int? | [x] | True if x is a positive fixed precision integer | reads | brief-number-tests |
decimal? | [n] | True if n is a BigDecimal | reads | brief-number-tests |
ratio? | [n] | True if n is a Ratio | reads | brief-number-tests |
rational? | [n] | True if n is a rational number | reads | brief-number-tests |
any? | [x] | True given any argument | reads | brief-truth |
boolean? | [x] | True if x is a Boolean | reads | brief-truth |
identical? | [x y] | Tests if 2 arguments are the same object | reads | brief-truth |
ifn? | [x] | True if x implements IFn | reads | brief-kinds |
associative? | [coll] | True if coll implements Associative | reads | brief-kinds |
counted? | [coll] | True if coll implements count in constant time | reads | brief-kinds |
indexed? | [coll] | True if coll implements Indexed, indicating efficient lookup by index | reads | brief-kinds |
list? | [x] | True if x implements IPersistentList | reads | brief-kinds |
map-entry? | [x] | True if x is a map entry | reads | brief-kinds |
reversible? | [coll] | True if coll implements Reversible | reads | brief-kinds |
seq? | [x] | True if x implements ISeq | reads | brief-kinds |
seqable? | [x] | True if the seq function is supported for x | reads | brief-kinds |
sorted? | [coll] | True if coll implements Sorted | reads | brief-kinds |
distinct? | [x] or [x y] or [x y & more] | True if no two of the arguments are = | reads | brief-over |
not-every? | [pred coll] | False if (pred x) is logical true for every x in coll, else true | reads | brief-over |
realized? | [x] | True if a value has been produced for a promise, delay, future or lazy sequence | reads | brief-over |
reduced? | [x] | True if x is the result of a call to reduced | reads | brief-fold |
char? | [x] | True if x is a Character | reads | brief-kinds |
ident? | [x] | True if x is a symbol or keyword | reads | brief-text |
qualified-ident? | [x] | True if x is a symbol or keyword with a namespace | reads | brief-text |
qualified-keyword? | [x] | True if x is a keyword with a namespace | reads | brief-text |
qualified-symbol? | [x] | True if x is a symbol with a namespace | reads | brief-text |
simple-ident? | [x] | True if x is a symbol or keyword without a namespace | reads | brief-text |
simple-keyword? | [x] | True if x is a keyword without a namespace | reads | brief-text |
simple-symbol? | [x] | True if x is a symbol without a namespace | reads | brief-text |
symbol? | [x] | True if x is a Symbol | reads | brief-kinds |
Numbers #
| Lisp | Takes | Gives | Does | Example |
|---|---|---|---|---|
+ | [] or [x] or [x y] | The sum of nums | reads | preface-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 … | reads | forms-calls |
* | [] or [x] or [x y] | The product of nums | reads | forms-calls |
(/ (double a) b) | 2 values | a number: the first over the second, as a decimal | reads | brief-fixed |
mod | [num div] | Modulus of num and div | reads | chance-in-turn |
quot | [num div] | Quot[ient] of dividing numerator by denominator | reads | brief-numbers |
min | [x] or [x y] or [x y & more] | The least of the nums | reads | brief-numbers |
max | [x] or [x y] or [x y & more] | The greatest of the nums | reads | forms-calls |
abs | [x] | (abs -3) is 3 | reads | brief-numbers |
round | [x] | (round 2.5) is 3 | reads | brief-numbers |
sqrt | [x] | (sqrt 9) is 3.0 | reads | brief-numbers |
sin | [x] | Sine, in radians | reads | brief-numbers |
cos | [x] | Cosine, in radians | reads | brief-numbers |
atan2 | [y x] | (atan2 y x): the angle to a point, in radians | reads | brief-numbers |
pi | nothing | π, 3.14159… | reads | brief-numbers |
(format "%.2f" (double n)) | 2 values | text: the number with that many decimals | reads | brief-fixed |
(/ a b) | 1 to 64 values | Lisp's /, a whole number over another a fraction | reads | brief-fixed |
inc | [x] | A number one greater than num | reads | maps-make |
dec | [x] | A number one less than num | reads | fn-recursion |
rem | [num div] | Remainder of dividing numerator by denominator | reads | brief-numbers |
int | [x] | Coerce to int | reads | brief-numbers |
long | [x] | Coerce to long | reads | brief-numbers |
double | [x] | Coerce to double | reads | brief-numbers |
compare | [x y] | Comparator | reads | brief-numbers |
rand | [] or [n] | A random floating point number between 0 (inclusive) and n (default 1) (exclusive) | reads | chance-words |
rand-int | [n] | A random integer between 0 (inclusive) and n (exclusive) | reads | chance-words |
bit-and | [x y] or [x y & more] | Bitwise and | reads | brief-bits |
bit-or | [x y] or [x y & more] | Bitwise or | reads | brief-bits |
bit-xor | [x y] or [x y & more] | Bitwise exclusive or | reads | brief-bits |
pow | [x y] | (pow 2 10) is 1024.0 | reads | brief-numbers |
tan | [x] | Tangent, in radians | reads | brief-numbers |
ceil | [x] | (ceil 2.1) is 3 | reads | brief-numbers |
clamp | [x lo hi] | (clamp x lo hi): x, kept between lo and hi | reads | brief-numbers |
parse-long | [s] | (parse-long "42") is 42; nil when it isn't a whole number | reads | text-format |
parse-double | [s] | (parse-double "2.5") is 2.5; nil when it isn't a number | reads | text-format |
inc' | [x] | A number one greater than num | reads | brief-number-kinds |
dec' | [x] | A number one less than num | reads | brief-number-kinds |
+' | [] or [x] or [x y] | The sum of nums | reads | brief-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 … | reads | brief-number-kinds |
*' | [] or [x] or [x y] | The product of nums | reads | brief-number-kinds |
bit-and-not | [x y] or [x y & more] | Bitwise and with complement | reads | brief-bits |
bit-clear | [x n] | Clear bit at index n | reads | brief-bits |
bit-flip | [x n] | Flip bit at index n | reads | brief-bits |
bit-not | [x] | Bitwise complement | reads | brief-bits |
bit-set | [x n] | Set bit at index n | reads | brief-bits |
bit-shift-left | [x n] | Bitwise shift left | reads | brief-bits |
bit-shift-right | [x n] | Bitwise shift right | reads | brief-bits |
bit-test | [x n] | Test bit at index n | reads | brief-bits |
unsigned-bit-shift-right | [x n] | Bitwise shift right, without sign-extension | reads | brief-bits |
byte | [x] | Coerce to byte | reads | brief-number-kinds |
short | [x] | Coerce to short | reads | brief-number-kinds |
float | [x] | Coerce to float | reads | brief-number-kinds |
num | [x] | Coerce to Number | reads | brief-numbers |
denominator | [r] | The denominator part of a Ratio | reads | brief-number-kinds |
numerator | [r] | The numerator part of a Ratio | reads | brief-number-kinds |
rationalize | [num] | Returns the rational value of num | reads | brief-number-kinds |
bigdec | [x] | Coerce to BigDecimal | reads | brief-number-kinds |
bigint | [x] | Coerce to BigInt | reads | brief-number-kinds |
biginteger | [x] | Coerce to BigInteger | reads | brief-number-kinds |
Values and text #
| Lisp | Takes | Gives | Does | Example |
|---|---|---|---|---|
str | 0 to 64 values | text: the values written one after another | reads | forms-calls |
(join sep l) | 2 values | text: the list's items with the separator between | reads | text-split |
:k | [its name, like rain] | a keyword: [its name, like rain] | reads | forms-values |
#"…" | [it, as text] | a pattern for re-find and the like: [it, as text] | reads | forms-collections |
boolean | [x] | Coerce to boolean | reads | brief-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 … | reads | text-basics |
name | [x] | The name String of a string, symbol or keyword | reads | text-keywords |
symbol | [name] or [ns name] | A Symbol with the given namespace and name | reads | brief-kinds |
lower | [s] | (lower "Hi") is "hi" | reads | text-words |
upper | [s] | (upper "hi") is "HI" | reads | text-words |
trim | [s] | Text without the spaces at either end | reads | text-words |
split | [s sep] | (split "a,b" ",") is ["a" "b"]; the separator is plain text | reads | text-split |
replace-all | [s a b] | (replace-all text old new), plain text, every time | reads | text-words |
words | [s] | (words "a b") is ["a" "b"] | reads | text-split |
format | [fmt & args] | Formats a string using java.lang.String.format, see java.util.Formatter for format string syntax | reads | text-format |
pr-str | [& xs] | Pr to a string, returning it | reads | brief-text |
re-find | [m] or [re s] | The next regex match, if any, of string to pattern, using java.util.regex.Matcher.find() | reads | text-patterns |
re-matches | [re s] | The match, if any, of string to pattern, using java.util.regex.Matcher.matches() | reads | text-patterns |
re-seq | [re s] | A lazy sequence of successive matches of pattern in string, using java.util.regex.Matcher.find(), ea … | reads | text-patterns |
type | [x] | The :type metadata of x, or its Class if none | reads | forms-type |
match | [text pattern] | (match "I love your garden" "i * your ") is ["love" "garden"]: each takes the words it stands for … | reads | parrot-match |
reflect | [text] | (reflect "I love your garden!") is "You love my garden!": the words turned round, as ELIZA did, read … | reads | mirror |
char | [x] | Coerce to char | reads | brief-text |
char-escape-string | Escape string for char or nil if none | reads | brief-text | |
char-name-string | Name string for char or nil if none | reads | brief-text | |
namespace | [x] | The namespace String of a symbol or keyword, or nil if not present | reads | brief-text |
print-str | [& xs] | Print to a string, returning it | reads | brief-text |
println-str | [& xs] | Println to a string, returning it | reads | brief-text |
prn-str | [& xs] | Prn to a string, returning it | reads | brief-text |
re-groups | [m] | The groups from the most recent match/find | reads | brief-text |
re-matcher | [re s] | An instance of java.util.regex.Matcher, for use, e.g | reads | brief-text |
Lists and maps #
| Lisp | Takes | Gives | Does | Example |
|---|---|---|---|---|
(get m :k), (:k m) | [map, key] or [map, key, otherwise] | one key of a map: [map, key] or [map, key, otherwise] | reads | names-apart |
{:k v} | entries | a map from keys to values: entries | reads | forms-type |
nth | [coll index] or [coll index not-found] | the item at that place, from 0 | reads | names-apart |
count | 1 value | how many items | reads | text-basics |
(vec (range a b)) | 1 to 2 values | a list of numbers: [from, below] or [below] | reads | lists-make |
(vec (concat a b)) | 1 to 64 values | one list of the lists' items | reads | porch-again |
(vec (reverse l)) | 1 value | the list, last first | reads | brief-fixed |
(assoc m :k v) | [map, key, value] | a map with one key set: [map, key, value] | reads | names-unchanged |
(mapv (fn [x] …) l) | each, in, value | a list worked out from each item of another: each, in, value | reads | stairs |
{"a" 1 :b 2} | [key, value, key, value …] | a map as Lisp writes one, keys of any kind, in order: [key, value, key, value …] | reads | forms-collections |
(get m k) | [map, key] or [map, key, otherwise] | Lisp's get, a key of any kind: [map, key] or [map, key, otherwise] | reads | home-storage |
(map f l) | [function, list …] | Lisp's map: [function, list …] | reads | choices-threading |
(range a b) | 0 to 3 values | a value | reads | lists-filter |
(concat a b) | 0 to 64 values | a value | reads | lists-make |
(reverse l) | 1 value | a value | reads | lists-make |
rand-nth | [coll] | A random element of the (sequential) collection | reads | chance-words |
shuffle | [coll] | A random permutation of coll | reads | chance-words |
assoc | [map key val] or [map key val & kvs] | Assoc[iate] | reads | stone-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 … | reads | maps-make |
dissoc | [map] or [map key] or [map key & ks] | Dissoc[iate] | reads | maps-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 … | reads | maps-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 … | reads | maps-make |
get-in | [m ks] or [m ks not-found] | The value in a nested associative structure, where ks is a sequence of keys | reads | maps-read |
keys | [map] | A sequence of the map's keys, in the same order as (seq map) | reads | maps-read |
vals | [map] | A sequence of the map's values, in the same order as (seq map) | reads | maps-read |
key | [e] | The key of the map entry | reads | brief-making |
val | [e] | The value in the map entry | reads | brief-making |
merge | [& maps] | A map that consists of the rest of the maps conj-ed onto the first | reads | maps-make |
conj | [] or [coll] or [coll x] | Conj[oin] | reads | lists-make |
cons | [x seq] | A new seq where x is the first element and seq is the rest | reads | lists-make |
into | [] or [to] or [to from] | A new coll consisting of to with all of the items of from conjoined | reads | brief-making |
not-empty | [coll] | If coll is empty, returns nil, else coll | reads | brief-making |
first | [coll] | The first item in the collection | reads | lists-read |
second | [x] | Same as (first (next x)) | reads | lists-read |
last | [coll] | The last item in coll, in linear time | reads | lists-read |
rest | [coll] | A possibly empty seq of the items after the first | reads | lists-read |
next | [coll] | A seq of the items after the first | reads | brief-lists |
butlast | [coll] | A seq of all but the last item in coll, in linear time | reads | brief-lists |
nthnext | [coll n] | The nth next of coll, (seq coll) when n is 0 | reads | brief-lists |
take | [n] or [n coll] | A lazy sequence of the first n items in coll, or all items if there are fewer than n | reads | lists-make |
drop | [n] or [n coll] | A laziness-preserving sequence of all but the first n items in coll | reads | lists-make |
take-last | [n coll] | A seq of the last n items in coll | reads | lists-make |
drop-last | [coll] or [n coll] | A lazy sequence of all but the last n (default 1) items in coll | reads | brief-lists |
take-while | [pred] or [pred coll] | A lazy sequence of successive items from coll while (pred item) returns logical true | reads | lists-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 … | reads | brief-lists |
vec | [coll] | Creates a new vector containing the contents of coll | reads | guest-log |
set | [coll] | A set of the distinct elements of coll | reads | names-swaps |
vector | [] or [a] or [a b] | Creates a new vector containing the args | reads | brief-making |
list | [& items] | Creates a new list containing the items | reads | forms-quote |
hash-map | [] or [& keyvals] | Keyval => key val Returns a new hash map with supplied mappings | reads | brief-making |
array-map | [] or [& keyvals] | Constructs an array-map | reads | brief-making |
hash-set | [] or [& keys] | A new hash set with supplied keys | reads | forms-collections |
sort | [coll] or [comp coll] | A sorted sequence of the items in coll | reads | lists-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) | reads | lists-sort |
distinct | [] or [coll] | A lazy sequence of the elements of coll with duplicates removed | reads | lists-make |
frequencies | [coll] | A map from distinct items in coll to the number of times they appear | reads | lists-sort |
group-by | [f coll] | A map of the elements of coll keyed by the result of f on each element | reads | lists-sort |
zipmap | [keys vals] | A map with the keys mapped to the corresponding vals | reads | maps-make |
select-keys | [map keyseq] | A map containing only those entries in map whose key is in keys | reads | maps-make |
find | [map key] | The map entry for key, or nil if key not present | reads | brief-making |
peek | [coll] | For a list or queue, same as first, for a vector, same as, but much more efficient than, last | reads | brief-lists |
pop | [coll] | For a list or queue, returns a new list/queue without the first item, for a vector, returns a new ve … | reads | brief-lists |
subvec | [v start] or [v start end] | A persistent vector of the items in vector from start (inclusive) to end (exclusive) | reads | brief-lists |
flatten | [x] | Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents … | reads | brief-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 apart | reads | lists-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 … | reads | brief-over |
interleave | [] or [c1] or [c1 c2] | A lazy seq of the first item in each coll, then the second etc | reads | brief-making |
interpose | [sep] or [sep coll] | A lazy seq of the elements of coll separated by sep | reads | lists-more |
repeat | [x] or [n x] | A lazy (infinite!, or length n if supplied) sequence of xs | reads | names-atom |
seq | [coll] | A seq on the collection | reads | brief-making |
empty | [coll] | An empty collection of the same category as coll, or nil | reads | brief-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 … | reads | brief-over |
filter | [pred] or [pred coll] | A lazy sequence of the items in coll for which (pred item) returns logical true | reads | lists-filter |
filterv | [pred coll] | A vector of the items in coll for which (pred item) returns logical true | reads | brief-over |
remove | [pred] or [pred coll] | A lazy sequence of the items in coll for which (pred item) returns logical false | reads | lists-filter |
keep | [f] or [f coll] | A lazy sequence of the non-nil results of (f item) | reads | lists-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 … | reads | lists-more |
mapcat | [f] or [f & colls] | The result of applying concat to the result of applying map to f and colls | reads | lists-more |
some | [pred coll] | The first logical true value of (pred x) for any x in coll, else nil | reads | lists-ask |
reduce | [f coll] or [f val coll] | F should be a function of 2 arguments | reads | lists-reduce |
reduce-kv | [f init coll] | Reduces an associative collection | reads | brief-over |
max-key | [k x] or [k x y] or [k x y & more] | The x for which (k x), a number, is greatest | reads | lists-sort |
min-key | [k x] or [k x y] or [k x y & more] | The x for which (k x), a number, is least | reads | brief-over |
== | [x] or [x y] or [x y & more] | Non-nil if nums all have the equivalent value (type-independent), otherwise false | reads | brief-numbers |
random-sample | [prob] or [prob coll] | Items from coll with random probability of prob (0.0 - 1.0) | reads | brief-chance |
pick-one | 0 to 64 values | a value | reads | chance-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 … | reads | brief-making |
disj | [set] or [set key] or [set key & ks] | Disj[oin] | reads | sets |
ffirst | [x] | Same as (first (first x)) | reads | brief-lists |
fnext | [x] | Same as (first (next x)) | reads | brief-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 … | reads | brief-making |
merge-with | [f & maps] | A map that consists of the rest of the maps conj-ed onto the first | reads | brief-making |
nfirst | [x] | Same as (next (first x)) | reads | brief-lists |
nnext | [x] | Same as (next (next x)) | reads | brief-lists |
nthrest | [coll n] | The nth rest of coll, coll when n is 0 | reads | brief-lists |
replace | [smap] or [smap coll] | Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a … | reads | brief-making |
rseq | [rev] | Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in rever … | reads | brief-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 >= | reads | brief-sorted |
sorted-map | [& keyvals] | Keyval => key val Returns a new sorted map with supplied mappings | reads | brief-sorted |
sorted-map-by | [comparator & keyvals] | Keyval => key val Returns a new sorted map with supplied mappings, using the supplied comparator | reads | brief-sorted |
sorted-set | [& keys] | A new sorted set with supplied keys | reads | brief-kinds |
sorted-set-by | [comparator & keys] | A new sorted set with supplied keys, using the supplied comparator | reads | brief-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 >= | reads | brief-sorted |
cat | [rf] | A transducer which concatenates the contents of each input, which must be a collection, into the red … | reads | brief-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 … | reads | brief-fold |
cycle | [coll] | A lazy (infinite!) sequence of repetitions of the items in coll | reads | brief-over |
dedupe | [] or [coll] | A lazy sequence removing consecutive duplicates in coll | reads | brief-over |
doall | [coll] or [n coll] | When lazy sequences are produced via functions that have side effects, any effects other than those … | reads | brief-over |
dorun | [coll] or [n coll] | When lazy sequences are produced via functions that have side effects, any effects other than those … | reads | brief-over |
eduction | [xform* coll] | A reducible/iterable application of the transducers to the items in coll | reads | brief-fold |
ensure-reduced | [x] | If x is already reduced?, returns it, else returns (reduced x) | reads | brief-fold |
halt-when | [pred] or [pred retf] | A transducer that ends transduction when pred returns true for an input | reads | brief-fold |
iterate | [f x] | A lazy (infinite!) sequence of x, (f x), (f (f x)) etc | reads | brief-over |
keep-indexed | [f] or [f coll] | A lazy sequence of the non-nil results of (f index item) | reads | brief-over |
partition-by | [f] or [f coll] | Applies f to each value in coll, splitting it each time f returns a new value | reads | brief-over |
reduced | [x] | Wraps x in a way such that a reduce will terminate with the value x | reads | brief-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 … | reads | brief-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 … | reads | brief-over |
replicate | [n x] | DEPRECATED: Use 'repeat' instead | reads | brief-over |
run! | [proc coll] | Runs the supplied procedure (via reduce), for purposes of side effects, on successive items in the c … | reads | brief-over |
sequence | [coll] or [xform coll] or [xform coll & colls] | Coerces coll to a (possibly empty) sequence, if it is not already one | reads | brief-over |
split-at | [n coll] | A vector of [(take n coll) (drop n coll)] | reads | brief-over |
split-with | [pred coll] | A vector of [(take-while pred coll) (drop-while pred coll)] | reads | brief-over |
take-nth | [n] or [n coll] | A lazy seq of every nth item in coll | reads | brief-over |
transduce | [xform f coll] or [xform f init coll] | Reduce with a transformation of f (xf) | reads | brief-fold |
tree-seq | [branch? children root] | A lazy sequence of the nodes in a tree, via a depth-first walk | reads | brief-over |
unreduced | [x] | If x is reduced?, returns (deref x), else returns x | reads | brief-fold |
Functions #
| Lisp | Takes | Gives | Does | Example |
|---|---|---|---|---|
(f a b) | fn, args | call a function the plan defined, or one named: fn, args | reads | fn-defn |
(fn [a b] …) | params, body | a function as a value: params, body | reads | lists-map-fn |
count, str … | [length] | one of these ops as a function, by its name: [length] | reads | maps-make |
((fn …) x) | [function, args …] | call a function worked out: [function, args …] | reads | fn-call |
identity | [x] | Its argument | reads | brief-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 args | reads | lists-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 … | reads | fn-makers |
comp | [] or [f] or [f g] | Takes a set of functions and returns a fn that is the composition of those fns | reads | fn-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 … | reads | fn-makers |
constantly | [x] | A function that takes any number of arguments and returns x | reads | fn-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 fns | reads | fn-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 … | reads | lists-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 … | reads | brief-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 … | reads | brief-functions |
memoize | [f] | A memoized version of a referentially transparent function | reads | brief-functions |
trampoline | [f] or [f & args] | Trampoline can be used to convert algorithms requiring mutual recursion without stack consumption | reads | brief-functions |
The toy's words #
| Lisp | Takes | Gives | Does | Example |
|---|---|---|---|---|
(defobject name {…}) | on_tick, open, name, verbs, state, title, on_hear, on_visit, spot | a 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 ops | changes your home | chance-die |
say | self, text | nothing; the toy says it (three lines a time, 280 characters a line) | changes the toy | preface-bell |
put! | self, key, value | the value; the toy's own state keeps it | changes the toy | bell |
state | self, key?, otherwise? | the toy's state, or one key of it | reads | brief-toy |
refuse | self, text | nothing; the toy says no, and nothing it did is kept | changes the toy | stone-pile |
colour | a colour name or #hex | the hex, or nil when the hour's three changes are used | changes the toy | mood-stone |
color | a colour name or #hex | as colour | changes the toy | brief-toy |
glow-colour | a colour name or #hex | as colour, for the glow | changes the toy | brief-toy |
glow-color | a colour name or #hex | as glow-colour | changes the toy | brief-toy |
my-colour | nothing | its maker's colour | reads | mood-stone |
my-color | nothing | as my-colour | reads | brief-toy |
my-glow | nothing | its maker's glow | reads | brief-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.