chickadee » srfi-13 » string-every

(string-every char/char-set/pred s [start end]) -> valueprocedure
(string-any char/char-set/pred s [start end]) -> valueprocedure

Checks to see if the given criteria is true of every / any character in S, proceeding from left (index START) to right (index END).

If CHAR/CHAR-SET/PRED is a character, it is tested for equality with the elements of S.

If CHAR/CHAR-SET/PRED is a character set, the elements of S are tested for membership in the set.

If CHAR/CHAR-SET/PRED is a predicate procedure, it is applied to the elements of S. The predicate is "witness-generating:"

  • If string-any returns true, the returned true value is the one produced by the application of the predicate.
  • If string-every returns true, the returned true value is the one produced by the final application of the predicate to S[END-1]. If string-every is applied to an empty sequence of characters, it simply returns #t.

If string-every or string-any apply the predicate to the final element of the selected sequence (i.e., S[END-1]), that final application is a tail call.

The names of these procedures do not end with a question mark -- this is to indicate that, in the predicate case, they do not return a simple boolean (#t or #f), but a general value.