char-set-unfold!

[procedure] char-set-unfold f p g seed [base-cs]

[procedure] char-set-unfold! f p g seed base-cs

SRFI-14: A fundamental character set generator. Better explained by the following definitions.

(define (char-set-unfold p f g seed base-cs) 
  (char-set-unfold! p f g seed (char-set-copy base-cs)))

(define (char-set-unfold! p f g seed base-cs)
  (let lp ((seed seed) (cs base-cs))
        (if (p seed) cs                                 ; P says we are done.
            (lp (g seed)                                ; Loop on (G SEED).
                (char-set-adjoin! cs (f seed))))))      ; Add (F SEED) to set.

See also char-set-fold.