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. For a version of this page that may be more recent, see SubstituteCowan in WG2's repo for R7RS-large.

Substitute­Cowan

cowan
2012-12-24 09:01:39
1history
source

Substitution

(substitute newobj oldobj list)

(substitute! newobj oldobj list)

(string-substitute newchar oldchar string)

(string-substitute! newchar oldchar string)

(vector-substitute newobj oldobj vector)

(vector-substitute! newobj oldobj vector)

These procedures return a newly constructed container (list, string, or vector) in which all elements of the original container that are the same (in the sense of eqv?) as oldobj (or oldchar) have been replaced by newobj (or newchar). The procedures with ! in their names do the same thing, but may destructively modify the container. (Common Lisp SUBSTITUTE, NSUBSTITUTE.)

Transformation

(transform transformer predicate list)

(transform! transformer predicate list)

(string-transform transformer predicate string)

(string-transform! transformer predicate string)

(vector-transform transformer predicate vector)

(vector-transform! transformer predicate vector)

These procedures return a newly constructed container (list, string, or vector) in which all elements of the container (list, string, or vector) on which predicate returns #t have been replaced by the result of calling transformer on the element. The procedures with ! in their names do the same thing, but may destructively modify the container. (Closely related to Common Lisp SUBSTITUTE-IF, NSUBSTITUTE-IF.)

Issues

Should these procedures, if accepted, be merged into the SRFI 1, SRFI 13, and SRFI 43 packages? They are only separated from it on historical grounds.