* moved char-whitespace?, char-alphabetic?, and char-downcase to
ikarus.chars
This commit is contained in:
parent
01a161d409
commit
fd5c6a1e47
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -1,10 +1,13 @@
|
||||||
|
|
||||||
(library (ikarus chars)
|
(library (ikarus chars)
|
||||||
(export char=? char<? char<=? char>? char>=?)
|
(export char=? char<? char<=? char>? char>=? char-whitespace?
|
||||||
|
char-alphabetic? char-downcase)
|
||||||
(import
|
(import
|
||||||
(except (ikarus) char=? char<? char<=? char>? char>=?)
|
(except (ikarus)
|
||||||
|
char=? char<? char<=? char>? char>=?
|
||||||
|
char-whitespace? char-alphabetic? char-downcase)
|
||||||
(only (scheme)
|
(only (scheme)
|
||||||
$car $cdr
|
$car $cdr $fx+ $fx- $fixnum->char $char->fixnum
|
||||||
$char= $char< $char<= $char> $char>=))
|
$char= $char< $char<= $char> $char>=))
|
||||||
|
|
||||||
;;; FIXME: this file is embarrasing
|
;;; FIXME: this file is embarrasing
|
||||||
|
@ -192,4 +195,38 @@
|
||||||
(err ($car c*))))))
|
(err ($car c*))))))
|
||||||
(err c2)))))
|
(err c2)))))
|
||||||
(err c1))])))
|
(err c1))])))
|
||||||
|
|
||||||
|
(define char-whitespace?
|
||||||
|
(lambda (c)
|
||||||
|
(cond
|
||||||
|
[(memq c '(#\space #\tab #\newline #\return)) #t]
|
||||||
|
[(char? c) #f]
|
||||||
|
[else
|
||||||
|
(error 'char-whitespace? "~s is not a character" c)])))
|
||||||
|
|
||||||
|
(define char-alphabetic?
|
||||||
|
(lambda (c)
|
||||||
|
(cond
|
||||||
|
[(char? c)
|
||||||
|
(cond
|
||||||
|
[($char<= #\a c) ($char<= c #\z)]
|
||||||
|
[($char<= #\A c) ($char<= c #\Z)]
|
||||||
|
[else #f])]
|
||||||
|
[else
|
||||||
|
(error 'char-alphabetic? "~s is not a character" c)])))
|
||||||
|
|
||||||
|
(define char-downcase
|
||||||
|
(lambda (c)
|
||||||
|
(cond
|
||||||
|
[(char? c)
|
||||||
|
(cond
|
||||||
|
[(and ($char<= #\A c) ($char<= c #\Z))
|
||||||
|
($fixnum->char
|
||||||
|
($fx+ ($char->fixnum c)
|
||||||
|
($fx- ($char->fixnum #\a)
|
||||||
|
($char->fixnum #\A))))]
|
||||||
|
[else c])]
|
||||||
|
[else
|
||||||
|
(error 'char-downcase "~s is not a character" c)])))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -69,40 +69,6 @@
|
||||||
ls
|
ls
|
||||||
(f x (cdr ls)))))))
|
(f x (cdr ls)))))))
|
||||||
|
|
||||||
(primitive-set! 'char-whitespace?
|
|
||||||
(lambda (c)
|
|
||||||
(cond
|
|
||||||
[(memq c '(#\space #\tab #\newline #\return)) #t]
|
|
||||||
[(char? c) #f]
|
|
||||||
[else
|
|
||||||
(error 'char-whitespace? "~s is not a character" c)])))
|
|
||||||
|
|
||||||
(primitive-set! 'char-alphabetic?
|
|
||||||
(lambda (c)
|
|
||||||
(cond
|
|
||||||
[(char? c)
|
|
||||||
(cond
|
|
||||||
[($char<= #\a c) ($char<= c #\z)]
|
|
||||||
[($char<= #\A c) ($char<= c #\Z)]
|
|
||||||
[else #f])]
|
|
||||||
[else
|
|
||||||
(error 'char-alphabetic? "~s is not a character" c)])))
|
|
||||||
|
|
||||||
(primitive-set! 'char-downcase
|
|
||||||
(lambda (c)
|
|
||||||
(cond
|
|
||||||
[(char? c)
|
|
||||||
(cond
|
|
||||||
[(and ($char<= #\A c) ($char<= c #\Z))
|
|
||||||
($fixnum->char
|
|
||||||
($fx+ ($char->fixnum c)
|
|
||||||
($fx- ($char->fixnum #\a)
|
|
||||||
($char->fixnum #\A))))]
|
|
||||||
[else c])]
|
|
||||||
[else
|
|
||||||
(error 'char-downcase "~s is not a character" c)])))
|
|
||||||
|
|
||||||
|
|
||||||
(primitive-set! 'set-car!
|
(primitive-set! 'set-car!
|
||||||
(lambda (x y)
|
(lambda (x y)
|
||||||
(unless (pair? x)
|
(unless (pair? x)
|
||||||
|
|
Loading…
Reference in New Issue