Part IV. Reference · this page as markdown
Words in brief
The chapters use the words a resident reaches for most. The table has more, and each of them works the same way in Plazmi Lisp as in the Lisp it comes from. This page shows the rest in small groups, each form with what it answered, so you can see exactly what a word does before you use it.
The fixed tests and their spellings #
(= :rain (:weather (sky)))
(contains? (set ["rose" "sage"]) "sage")
(/ (double 3) 4)
(format "%.1f" (double 2))
(vec (reverse [1 2 3]))
(/ 6 4)false
true
0.75
"2.0"
[3 2 1]
3/2Names that change: the other two shapes #
(let [stones (atom 10)
pick (atom "")]
(swap! stones - 3)
(reset! pick (rand-nth ["rose" "sage"]))
[(deref stones) (string? (deref pick))])[7 true]Numbers #
(quot 17 5)
(rem 17 5)
(mod -7 3)
(min 4 2 8)
(abs -3)
(round 2.5)
(sqrt 16)
(pow 2 10)
(ceil 2.1)
(clamp 15 0 10)
(sin 0)
(cos 0)
(tan 0)
(atan2 1 1)
(* 2 pi)
(int 3.7)
(long 3.7)
(double 3)
(num 3)
(compare 1 2)
(== 2 2.0)3
2
2
2
3
3
4.0
1024.0
3
10
0.0
1.0
0.0
0.7853981633974483
6.283185307179586
3
3
3.0
3
-1
trueNumbers of other kinds #
(inc' 1)
(dec' 1)
(+' 1 2)
(-' 3 1)
(*' 2 3)
(byte 7)
(short 7)
(float 1.5)
(bigint 7)
(bigdec 7)
(biginteger 7)
(numerator (/ 3 4))
(denominator (/ 3 4))
(rationalize 0.5)2
0
3
2
6
7
7
1.5
7N
7M
7
3
4
1/2Tests on numbers #
(number? 1)
(integer? 1.5)
(double? 1.5)
(float? 1.5)
(int? 1)
(nat-int? 0)
(neg-int? -1)
(pos-int? 1)
(decimal? 1)
(ratio? (/ 1 2))
(rational? 1)true
false
true
true
true
true
true
true
false
true
trueBits #
(bit-and 12 10)
(bit-or 12 10)
(bit-xor 12 10)
(bit-not 0)
(bit-and-not 12 10)
(bit-set 0 3)
(bit-clear 15 0)
(bit-flip 0 2)
(bit-test 4 2)
(bit-shift-left 1 4)
(bit-shift-right 16 2)
(unsigned-bit-shift-right 16 2)8
14
6
-1
4
8
14
4
true
16
4
4True, false and nothing #
(some? 1)
(true? true)
(false? false)
(boolean nil)
(boolean? true)
(identity 7)
(any? nil)
(identical? :a :a)true
true
true
false
true
7
true
trueWhat kind of value #
(map? {})
(string? "a")
(vector? [])
(coll? [])
(keyword? :a)
(set? #{})
(sequential? [])
(fn? inc)
(ifn? :a)
(seq? '(1))
(seqable? [])
(list? '(1))
(associative? {})
(counted? [])
(indexed? [])
(reversible? [])
(sorted? (sorted-set 1))
(map-entry? (first {:a 1}))
(symbol? 'a)
(char? "a")true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
falseLists, front and back #
(next [1])
(butlast [1 2 3])
(nthnext [1 2 3] 2)
(nthrest [1 2 3] 2)
(drop-last [1 2 3])
(drop-while odd? [1 3 4 5])
(ffirst [[1 2]])
(fnext [1 2])
(nfirst [[1 2 3]])
(nnext [1 2 3])
(peek [1 2])
(pop [1 2])
(subvec [1 2 3 4] 1 3)
(rseq [1 2 3])nil
(1 2)
(3)
(3)
(1 2)
(4 5)
1
2
(2 3)
(3)
2
[1]
[2 3]
(3 2 1)Making lists and maps #
(vector 1 2)
(list* 1 [2 3])
(hash-map :a 1)
(array-map :a 1)
(find {:a 1} :a)
(key (first {:a 1}))
(val (first {:a 1}))
(seq [1 2])
(empty [1 2])
(into [] '(1 2))
(not-empty [])
(merge-with + {:a 1} {:a 2 :b 3})
(replace {1 :one} [1 2 1])
(flatten [[1 [2]] 3])
(interleave [1 2] [:a :b])
(bounded-count 2 [1 2 3])[1 2]
(1 2 3)
{:a 1}
{:a 1}
[:a 1]
:a
1
(1 2)
[]
[1 2]
nil
{:a 3, :b 3}
[:one 2 :one]
(1 2 3)
(1 :a 2 :b)
3Over a list #
(mapv inc [1 2])
(filterv odd? [1 2 3])
(reduce-kv (fn [total k v] (+ total v)) 0 {:a 1 :b 2})
(min-key count "aa" "b" "ccc")
(partition-all 2 [1 2 3])
(split-at 2 [1 2 3])
(split-with odd? [1 3 4 1])
(take-nth 2 [1 2 3 4 5])
(partition-by odd? [1 3 2 4 5])
(dedupe [1 1 2 1])
(distinct? 1 2 3)
(keep-indexed (fn [i x] (when (even? i) x)) [:a :b :c])
(not-every? odd? [1 2])
(reductions + [1 2 3])
(take 4 (iterate inc 0))
(take 3 (cycle [1 2]))
(repeatedly 2 (fn [] "x"))
(replicate 2 :a)
(tree-seq coll? seq [1 [2]])
(doall (map inc [1 2]))
(dorun (map inc [1 2]))
(run! inc [1 2])
(sequence (filter odd?) [1 2 3])
(realized? (map inc [1 2]))[2 3]
[1 3]
3
"b"
((1 2) (3))
[(1 2) (3)]
[(1 3) (4 1)]
(1 3 5)
((1 3) (2 4) (5))
(1 2 1)
true
(:a :c)
true
(1 3 6)
(0 1 2 3)
(1 2 1)
("x" "x")
(:a :a)
([1 [2]] 1 [2] 2)
(2 3)
nil
nil
(1 3)
falseSorted maps and sets #
(sorted-map :b 1 :a 2)
(sorted-set 3 1 2)
(sorted-map-by > 1 :a 2 :b)
(sorted-set-by > 1 2 3)
(subseq (sorted-set 1 2 3 4) > 2)
(rsubseq (sorted-set 1 2 3 4) < 3){:a 2, :b 1}
#{1 2 3}
{2 :b, 1 :a}
#{3 2 1}
(3 4)
(2 1)Steps that fold #
(transduce (filter odd?) + 0 [1 2 3])
(into [] cat [[1 2] [3]])
(into [] (halt-when neg?) [1 2 -1 3])
(into [] (eduction (filter odd?) [1 2 3]))
(reduce (fn [a x] (if (> x 2) (reduced a) (+ a x))) 0 [1 2 3 4])
(reduced? (reduced 1))
(unreduced (reduced 1))
(reduced? (ensure-reduced 1))
((completing +) 1)4
[1 2 3]
-1
[1 3]
3
true
1
true
1Functions of functions #
((every-pred odd? pos?) 3)
((some-fn even? neg?) 3)
((memoize inc) 1)
(trampoline (fn [] "done"))true
false
2
"done"Text, symbols and keywords #
(symbol "bell")
(pr-str "a" 1)
(print-str "a" 1)
(println-str "a")
(prn-str "a")
(namespace :garden/rose)
(ident? :a)
(simple-ident? :a)
(simple-keyword? :a)
(simple-symbol? 'a)
(qualified-ident? :garden/rose)
(qualified-keyword? :garden/rose)
(qualified-symbol? 'garden/rose)
(char 97)
(char-escape-string (char 10))
(char-name-string (char 32))
(let [m (re-matcher #"([a-z]+)-([0-9]+)" "bell-12")]
(re-find m)
(re-groups m))bell
"\"a\" 1"
"a 1"
"a\n"
"\"a\"\n"
"garden"
true
true
true
true
true
true
true
\a
"\\n"
"space"
["bell-12" "bell" "12"]
["bell-12" "bell" "12"]Chance, once more #
(count (random-sample 1 [1 2 3]))3A toy's other words #
(defobject lantern-two
{:name "Little lantern"
:state {:lit true}
:verbs {:look (fn [self who]
(say self (str "State: " (state self :lit) ", " (state self :missing "none") ".")))
:light (fn [self who]
(color "butter yellow")
(glow-colour "mint")
(say self (str "Colour " (my-color) ", glow " (my-glow) ".")))
:dim (fn [self who]
(glow-color "lilac")
(say self (str "Glow " (my-glow) ".")))}})The lantern two is ready.> look little lantern
[Juniper's little lantern] State: true, none.
> light little lantern
[Juniper's little lantern] Colour …, glow ….
> dim little lantern
[Juniper's little lantern] Glow ….(state self k otherwise) reads one key with a value for when it's missing. color, glow-color and my-color are the same words as colour, glow-colour and my-colour, spelt the other way.
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.