This library provides immutable pairs. Note that they are simply immutable and make no special provisions for functional update: there are no analogues of set-car! and set-cdr!. They are also unrelated to ordinary Scheme pairs.
From immutable pairs plus the empty list we can build immutable lists. Note that the empty list can be safely used in both mutable and immutable lists, because it itself is immutable.
(iquote <datum>)
Returns a copy of <datum> with all pairs replaced by immutable pairs. Note that <datum> can be circular or have shared structure, which is preserved.
(immutable obj)
Returns a copy of obj with all pairs replaced by immutable pairs. Note that obj can be circular or have shared structure, which is preserved. If there are no pairs, the result may be the same as the argument.
(mutable obj)
Returns a copy of obj with all immutable pairs replaced by pairs. Note that obj can be circular or have shared structure, which is preserved. If there are no immutable pairs, the result may be the same as the argument.
The following procedures are renamed from those in SRFI 1. They are a superset of those in R5RS and R7RS-small. The intention is to make immutable lists as close to a drop-in replacement for ordinary lists as possible. Each one does exactly what you'd expect from reading SRFI 1.
Constructors:
icons ilist ixcons icons* make-ilist ilist-tabulate ilist-copy circular-ilist ilist-iota
Predicates:
ipair? ilist? proper-ilist? circular-ilist? dotted-ilist? null-ilist? ilist=
Selectors:
icar icdr ... icddadr icddddr ilist-ref icar+icdr ilist-take ilist-drop (also known as ilist-tail) ilist-take-right ilist-drop-right split-at ilist-last ilist-last-pair
Miscellaneous:
ilist-length ilist-append ilist-concatenate ilist-reverse ilist-append-reverse ilist-zip ilist-unzip1 ilist-unzip2 ilist-unzip3 ilist-unzip4 ilist-unzip5 ilist-count
Fold, unfold & map:
ilist-map ilist-for-each ilist-fold ilist-unfold ilist-pair-fold ilist-reduce ilist-fold-right ilist-unfold-right ipair-fold-right ilist-reduce-right ilist-append-map ilist-pair-for-each ilist-filter-map ilist-map-in-order
Filtering & partitioning:
ilist-filter ilist-partition ilist-remove
Searching:
ilist-member ilist-memq ilist-memv ilist-find ilist-find-tail ilist-any ilist-every ilist-index ilist-take-while ilist-drop-while ilist-span ilist-break
Deleting:
ilist-delete ilist-delete-duplicates
Immutable association lists:
ilist-assoc ilist-assq ilist-assv ialist-cons ialist-copy ialist-delete
Set operations on immutable lists:
ilist-set<= ilist-set= ilist-set-adjoin ilist-set-union ilist-set-intersection ilist-set-difference ilist-set-xor ilist-set-diff+intersection