mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +02:00
Added (char-downcase)
This commit is contained in:
parent
11d861a97c
commit
bc151ed781
1 changed files with 10 additions and 1 deletions
11
trans.scm
11
trans.scm
|
@ -72,13 +72,22 @@
|
||||||
(define (char>? c1 c2 . cs) (Cyc-bin-op-char > c1 (cons c2 cs)))
|
(define (char>? c1 c2 . cs) (Cyc-bin-op-char > c1 (cons c2 cs)))
|
||||||
(define (char<=? c1 c2 . cs) (Cyc-bin-op-char <= c1 (cons c2 cs)))
|
(define (char<=? c1 c2 . cs) (Cyc-bin-op-char <= c1 (cons c2 cs)))
|
||||||
(define (char>=? c1 c2 . cs) (Cyc-bin-op-char >= c1 (cons c2 cs)))
|
(define (char>=? c1 c2 . cs) (Cyc-bin-op-char >= c1 (cons c2 cs)))
|
||||||
(define (char-upcase c)
|
; TODO: char-ci predicates
|
||||||
|
(define (char-upcase c) ;; ASCII-only
|
||||||
(if (char-lower-case? c)
|
(if (char-lower-case? c)
|
||||||
(integer->char
|
(integer->char
|
||||||
(- (char->integer c)
|
(- (char->integer c)
|
||||||
(- (char->integer #\a)
|
(- (char->integer #\a)
|
||||||
(char->integer #\A))))
|
(char->integer #\A))))
|
||||||
c))
|
c))
|
||||||
|
(define (char-downcase c) ;; ASCII-only
|
||||||
|
(if (char-upper-case? c)
|
||||||
|
(integer->char
|
||||||
|
(+ (char->integer c)
|
||||||
|
(- (char->integer #\a)
|
||||||
|
(char->integer #\A))))
|
||||||
|
c))
|
||||||
|
; TODO: char-foldcase
|
||||||
(define (char-alphabetic? c) (and (char>=? c #\A) (char<=? c #\z))) ;; ASCII-only
|
(define (char-alphabetic? c) (and (char>=? c #\A) (char<=? c #\z))) ;; ASCII-only
|
||||||
(define (char-upper-case? c) (and (char>=? c #\A) (char<=? c #\Z))) ;; ASCII-only
|
(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-lower-case? c) (and (char>=? c #\a) (char<=? c #\z))) ;; ASCII-only
|
||||||
|
|
Loading…
Add table
Reference in a new issue