summaryrefslogtreecommitdiffstats
path: root/strcase.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:28 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:28 -0800
commit87b82b5822ca54228cfa6df29be3ad9d4bc47d16 (patch)
tree1eb4f87abd38bea56e08335d939e8171d5e7bfc7 /strcase.scm
parentbd9733926076885e3417b74de76e4c9c7bc56254 (diff)
downloadslib-87b82b5822ca54228cfa6df29be3ad9d4bc47d16.tar.gz
slib-87b82b5822ca54228cfa6df29be3ad9d4bc47d16.zip
Import Upstream version 2d2upstream/2d2
Diffstat (limited to 'strcase.scm')
-rw-r--r--strcase.scm22
1 files changed, 19 insertions, 3 deletions
diff --git a/strcase.scm b/strcase.scm
index b46b223..30b58ad 100644
--- a/strcase.scm
+++ b/strcase.scm
@@ -4,6 +4,7 @@
; This code is in the public domain.
; Modified by Aubrey Jaffer Nov 1992.
+; SYMBOL-APPEND added by A. Jaffer 2001.
; Authors of the original version were Ken Dickey and Aubrey Jaffer.
;string-upcase, string-downcase, string-capitalize
@@ -45,6 +46,21 @@
(string-capitalize! (string-copy str)))
(define string-ci->symbol
- (if (equal? "a" (symbol->string 'a))
- (lambda (str) (string->symbol (string-downcase str)))
- (lambda (str) (string->symbol (string-upcase str)))))
+ (let ((s2cis (if (equal? "x" (symbol->string 'x))
+ string-downcase string-upcase)))
+ (lambda (str) (string->symbol (s2cis str)))))
+
+(define symbol-append
+ (let ((s2cis (if (equal? "x" (symbol->string 'x))
+ string-downcase string-upcase)))
+ (lambda args
+ (string->symbol
+ (apply string-append
+ (map
+ (lambda (obj)
+ (cond ((string? obj) (s2cis obj))
+ ((number? obj) (s2cis (number->string obj)))
+ ((symbol? obj) (symbol->string obj))
+ ((not obj) "")
+ (else (slib:error 'wrong-type-to 'symbol-append obj))))
+ args))))))