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.

Examples:
  (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
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to