Added string-copy

This commit is contained in:
Abdulaziz Ghuloum 2007-08-28 12:46:12 -04:00
parent 86a28c3822
commit 2b6a3ef715
5 changed files with 17 additions and 13 deletions

Binary file not shown.

View File

@ -33,10 +33,6 @@
(match-and-bind targs (msg-arg* ...) (begin b b* ...))] ... (match-and-bind targs (msg-arg* ...) (begin b b* ...))] ...
[else else1 else2 ...]))])) [else else1 else2 ...]))]))
(define string-copy
(lambda (s)
(substring s 0 (string-length s))))
(define concat-old (define concat-old
(lambda (str i ls) (lambda (str i ls)
(let ([n (sum i ls)]) (let ([n (sum i ls)])

View File

@ -1,7 +1,8 @@
(library (ikarus strings) (library (ikarus strings)
(export string-length string-ref string-set! make-string string->list string=? (export string-length string-ref string-set! make-string string->list string=?
string-append substring string list->string uuid) string-append substring string list->string uuid
string-copy)
(import (import
(ikarus system $strings) (ikarus system $strings)
(ikarus system $fx) (ikarus system $fx)
@ -10,7 +11,7 @@
(ikarus system $pairs) (ikarus system $pairs)
(except (ikarus) string-length string-ref string-set! make-string (except (ikarus) string-length string-ref string-set! make-string
string->list string=? string-append substring string string->list string=? string-append substring string
list->string uuid)) list->string uuid string-copy))
(define string-length (define string-length
@ -117,6 +118,12 @@
"" ""
(fill s ($make-string len) n m 0))))))) (fill s ($make-string len) n m 0)))))))
(define string-copy
(lambda (s)
(if (string? s)
(substring s 0 (string-length s))
(error 'string-copy "~s is not a string" s))))
(module (string=?) (module (string=?)
(define bstring=? (define bstring=?
(lambda (s1 s2 i j) (lambda (s1 s2 i j)

View File

@ -235,9 +235,9 @@
[and i r] [and i r]
[or i r] [or i r]
[... i r] [... i r]
[=> i r] [=> i r]
[else i r] [else i r]
[_ i r] [_ i r]
)) ))
(define ikarus-procedures-map (define ikarus-procedures-map
@ -331,6 +331,7 @@
[string=? i r] [string=? i r]
[string-ci=? i unicode] [string-ci=? i unicode]
[substring i r] [substring i r]
[string-copy i r]
[string-append i r] [string-append i r]
[string->list i r] [string->list i r]
[list->string i r] [list->string i r]

View File

@ -203,7 +203,7 @@
[string->number C ba] [string->number C ba]
[string->symbol C ba] [string->symbol C ba]
[string-append C ba] [string-append C ba]
[string-copy S ba] [string-copy C ba]
[string-for-each S ba] [string-for-each S ba]
[string-length C ba] [string-length C ba]
[string-ref C ba] [string-ref C ba]
@ -231,9 +231,9 @@
[vector? C ba] [vector? C ba]
[zero? C ba] [zero? C ba]
[... C ba sc] [... C ba sc]
[=> S ba ex] [=> C ba ex]
[_ S ba sc] [_ C ba sc]
[else S ba ex] [else C ba ex]
[bitwise-and D bw] [bitwise-and D bw]
[bitwise-arithmetic-shift D bw] [bitwise-arithmetic-shift D bw]