9 Printing and Reading

This chapter covers the printed representations of FSet collections, and two slightly different sets of reader macros that allow collection expressions to be written in a similar notation in your source code.

This table summarizes the printed representations of the persistent FSet types.

typeprinted formnotes
wb-set#{ e0 e1 … }[compare-fn]1, 3
ch-set##{ e0 e1 … }[compare-fn]2, 3
complement-set~set4
wb-map#{| (k0 v0) (k1 v1) … |}[key-compare-fn;val-compare-fn]/default1, 5, 6
ch-map##{| (k0 v0) (k1 v1) … |}[key-compare-fn;val-compare-fn]/default2, 5, 6
wb-bag#{% e0 #%(e1 m1) … %}[compare-fn]1, 3
ch-bag##{% e0 #%(e1 m1) … %}[compare-fn]2, 3
wb-seq#[ e0 e1 … ]/default6, 7
ch-replay-set##{= e0 e1 … }[compare-fn]2, 3
ch-replay-map##{=| (k0 v0) (k1 v1) … |}[key-compare-fn;val-compare-fn]/default2, 5, 6
ch-2-relation##{+ (k0 v0) (k1 v1) … +}[key-compare-fn;val-compare-fn]2, 5
wb-2-relation#{+ (k0 v0) (k1 v1) … +}[key-compare-fn;val-compare-fn]1, 5
dyn-tuple#~< (k0 v0) (k1 v1) … >

Notes:

  1. The single # indicates WB.
  2. The double # indicates CHAMP.
  3. The comparison function and its containing brackets are printed only if it is not compare.
  4. That is, a tilde followed by the printed representation of the complemented set.
  5. The comparison functions are printed only if they are not compare. If both of them are compare, the brackets are also omitted.
  6. The default, and the leading slash marking it, are printed only if it is not nil; if the collection has no default, /[no default] is printed.
  7. Char seqs — seqs containing only characters — are printed as strings preceded by #, possibly also suffixed with a slash and default, or /[no default]. Within a non-char seq, runs of consecutive characters are printed as #$ followed by the characters as a string.