[racket] This is too clumsy. Is there a better way?

From: Rouben Rostamian (rostamian at umbc.edu)
Date: Fri Jul 13 09:02:07 EDT 2012

The function `all-lower-case?' defined below takes a string and
returns #f if the string has at least one uppercase alphabetic
character, else returns #t.

  (all-lower-case? "asdf12#@") => #t
  (all-lower-case? "asDf12#@") => #f

Here is how I have written it:

(define (all-lower-case? str)
  (not (memq #t
             (map (lambda (i)
                    (if (and (char-alphabetic? i) (char-upper-case? i))
                      #t #f))
                  (string->list str)))))

This looks rather clumsy to me.  I am converting the string into
a list of characters, then I check the case of each character
and issue the requisite verdict.  It seems to me that there
ought to be a neater way.  Any suggestions?

Rouben Rostamian

Posted on the users mailing list.