| ||Recursion and Higher-order Functions - slide 7 : 35|
Examples with recursion: string-of-char-list?
The function string-of-char-list? is a predicate (a boolean function) that finds out if a string is formed
exclusively by characters from a particular alphabet
(define (string-of-char-list? str char-list)
(string-of-char-list-1? str char-list 0 (string-length str)))
(define (string-of-char-list-1? str char-list i lgt)
(if (= i lgt)
(and (memv (string-ref str i) char-list)
(string-of-char-list-1? str char-list (+ i 1) lgt))))
Applications of string-of-char-list?.