This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.
Source for wiki ImmutablePairsCowan version 1
author
cowan
comment
ipnr
127.10.177.1
name
ImmutablePairsCowan
readonly
0
text
== Rationale ==
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.
== Issues ==
1. Should there be a lexical syntax for `iquote`, analogous to `'` for `quote`? One possibility would be `#i`, which means "inexact" when used before a number, but nothing special when it precedes a literal list.
== Syntax ==
`(iquote `<list>`)`
Returns an immutable version of <list>. If <list> is not a pair, it is returned.
== Procedures ==
The following procedures are renamed from those in [http://srfi.schemers.org/srfi-1/srfi-1.html 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? proper-ilist? circular-ilist? dotted-ilist? null-ilist? ilist=`
Selectors:
`icar icdr` ... `icddadr icddddr ilist-ref icar+icdr ilist-take ilist-drop ilist-take-right ilist-drop-right split-at ilist-last ilist-last-pair`
Miscellaneous:
`ilist-length 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`
time
2013-06-16 09:42:46
version
1