Next: , Previous: SRFI-13 Reverse/Append, Up: SRFI-13


39.11.12 Fold/Unfold/Map

string-map, string-for-each etc. are for iterating over the characters a string is composed of. The fold and unfold procedures are list iterators and constructors.

— Scheme Procedure: string-map proc s [start [end]]

Return a new string made by mapping procedure proc over s. proc is a character-to-character procedure. The order in which the procedure is applied to the string elements is not specified.

— Scheme Procedure: string-map! proc s [start [end]]

Map procedure proc over s, modifying it in-place. proc is a character-to-character procedure. The order in which the procedure is applied to the string elements is not specified.

— Scheme Procedure: string-fold kons knil s [start [end]]

Fold kons over the characters of s, with knil as the terminating element, from left to right. kons is called with two arguments: The actual character and the last result of kons' application.

— Scheme Procedure: string-unfold p f g seed [base [make-final]]

Return a new string constructed as specified by procedures p, f, and g, given an initial value seed. More precisely:

— Scheme Procedure: string-for-each proc s [start [end]]

Map proc over the characters in s in ascending order.