Returns the lowercase form of ch if ch is a member of the uppercase-list list, otherwise returns ch.
(define (case-fold-down-char ch)
;; Returns the lowercase form of ch or ch if ch is not an uppercase form
(let ((idx (list-member-find ch uppercase-list)))
(if (> idx 0)
(list-member-get lowercase-list idx)
ch))) |
(case-fold-down-charlist charlist) |
Returns charlist with all uppercase characters converted to lowercase.
(define (case-fold-down-charlist charlist)
;; Shifts all characters in charlist to lowercase
(if (null? charlist)
'()
(cons (case-fold-down-char (car charlist))
(case-fold-down-charlist (cdr charlist))))) |
Returns the uppercase form of ch if ch is a member of the lowercase-list list, otherwise returns ch.
(define (case-fold-up-char ch)
;; Returns the uppercase form of ch or ch if ch is not a lowercase form
(let ((idx (list-member-find ch lowercase-list)))
(if (> idx 0)
(list-member-get uppercase-list idx)
ch)))
(define uppercase-list
'(#\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M
#\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z))
(define lowercase-list
'(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m
#\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z)) |
(case-fold-up-charlist charlist) |
Returns charlist with all lowercase characters converted to uppercase.
(define (case-fold-up-charlist charlist)
;; Shifts all characters in charlist to uppercase
(if (null? charlist)
'()
(cons (case-fold-up-char (car charlist))
(case-fold-up-charlist (cdr charlist))))) |