Do not return value of (member), but a boolean

This commit is contained in:
Justin Ethier 2016-08-20 02:54:14 -04:00
parent 5ce09c6698
commit ffccd7ae0b

View file

@ -61,8 +61,14 @@
(define (char-alphabetic? c) (or (char-upper-case? c) (char-lower-case? c)))
(define (char-upper-case? c) (and (char>=? c #\A) (char<=? c #\Z))) ;; ASCII-only
(define (char-lower-case? c) (and (char>=? c #\a) (char<=? c #\z))) ;; ASCII-only
(define (char-numeric? c) (member c '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
(define (char-whitespace? c) (member c '(#\tab #\space #\return #\newline)))
(define (char-numeric? c)
(if (member c '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
#t
#f))
(define (char-whitespace? c)
(if (member c '(#\tab #\space #\return #\newline))
#t
#f))
(define (digit-value c)
(if (char-numeric? c)
(- (char->integer c) (char->integer #\0))