diff options
Diffstat (limited to 'strings.csc')
| -rw-r--r-- | strings.csc | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/strings.csc b/strings.csc deleted file mode 100644 index 737c91b..0000000 --- a/strings.csc +++ /dev/null @@ -1,46 +0,0 @@ -(define-library (csc strings) - (export - find - join - not-found-error? - prefix? - str-quote) - (import (scheme base) - (only (scheme case-lambda) case-lambda) - (only (scheme write) write) - (only (csc list) intercalate)) - (begin - - - (define prefix? - (case-lambda - ((prefix str) (prefix? prefix str 0)) - ((prefix str start) - (and (<= (string-length prefix) (- (string-length str) start)) - (string=? prefix (substring str start (+ start (string-length prefix)))))))) - - - (define (str-quote s) - (let ((out (open-output-string))) - (write s out) - (get-output-string out))) - - - (define-record-type <not-found-error> - (make-not-found-error) - not-found-error?) - - - (define find - (case-lambda - ((match str) (find match str 0 (string-length str))) - ((match str start) (find match str start (string-length str))) - ((match str start end) - (let loop ((i start)) - (cond ((>= i end) (raise (make-not-found-error))) - ((prefix? match str i) i) - (else (loop (+ 1 i)))))))) - - - (define (join sep . strings) - (apply string-append (intercalate sep strings))))) |
