Note: The SRFI number is not yet official and is therefore subject to change.
Abstract: Scheme currently does not provide immutable pairs corresponding to its existing mutable pairs, although most uses of pairs do not exploit their mutability. The Racket system takes the radical approach of making Scheme's pairs immutable, and providing a minimal library of mutable pairs with procedures named mpair?, mcons, mcar, mcdr, set-mcar!, set-mcdr!. This SRFI takes the opposite approach of leaving Scheme's pairs unchanged and providing a full set of routines for creating and dealing with immutable pairs. The sample implementation is portable and efficient. Rationale: Rather than attempting to design this library from scratch, I have chosen the conservative option of modifying SRFI 1. Consequently, most of the rationale given in that document applies to this one as well. I have made the following changes: * Removed all linear-update procedures ending in ! * Removed all references to circular lists (there will be a future SRFI for immutable bidirectional cycles). * Removed first, second , etc., which are mostly used for poor man's records. * Removed the O(n2) lists-as-sets procedures (there will be a future SRFI supporting O(n log n) immutable sets). * Inserted an i at a judicious place in each identifier, usually at the beginning. However, because "icons" means something else in both ordinary English and computer jargon, the basic constructor and its immediate relatives are named ipair, xipair and ipair* instead. * Added procedures for conversion between ordinary and immutable pairs, lists, and trees. * Added an analogue of apply for applying a procedure to an immutable list of arguments. SRFI: http://www.ccil.org/~cowan/temp/srfi-116.html Implementation: http://www.ccil.org/~cowan/temp/ilists.tar.gz Please send comments to <[email protected]> when it is created, or to this list in the meantime. -- John Cowan http://www.ccil.org/~cowan [email protected] Schlingt dreifach einen Kreis vom dies! Schliesst euer Aug vor heiliger Schau, Denn er genoss vom Honig-Tau, Und trank die Milch vom Paradies. _______________________________________________ Scheme-reports mailing list [email protected] http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports
