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

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri Jul 13 09:06:38 EDT 2012

On Fri, Jul 13, 2012 at 9:02 AM, Rouben Rostamian <rostamian at umbc.edu> wrote:
> 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.

Welcome to Racket v5.3.0.14.
-> (define (all-lower-case? s)
     (for/and ([c s] #:when (char-alphabetic? c))
        (not (char-upper-case? c))))
-> (all-lower-case? "asdf12#@")
#t
-> (all-lower-case? "asDf12#@")
#f


-- 
sam th
samth at ccs.neu.edu

Posted on the users mailing list.