string conversion functions
This commit is contained in:
parent
65a1b0f5af
commit
96609de180
|
@ -1 +1 @@
|
|||
Subproject commit 8f93ddd87b1f2b705c204f51ba1365a6b7a7f547
|
||||
Subproject commit c6b46ae2acba046f2c1c3f26e862134de0df846a
|
|
@ -154,6 +154,8 @@
|
|||
string-copy!
|
||||
string-append
|
||||
string-fill!
|
||||
string->list
|
||||
list->string
|
||||
string=?
|
||||
string<?
|
||||
string>?
|
||||
|
|
|
@ -365,26 +365,6 @@
|
|||
|
||||
;; 6.7. Strings
|
||||
|
||||
(define (string->list string . opts)
|
||||
(let ((start (if (pair? opts) (car opts) 0))
|
||||
(end (if (>= (length opts) 2)
|
||||
(cadr opts)
|
||||
(string-length string))))
|
||||
(do ((i start (+ i 1))
|
||||
(res '()))
|
||||
((= i end)
|
||||
(reverse res))
|
||||
(set! res (cons (string-ref string i) res)))))
|
||||
|
||||
(define (list->string list)
|
||||
(let ((len (length list)))
|
||||
(let ((v (make-string len)))
|
||||
(do ((i 0 (+ i 1))
|
||||
(l list (cdr l)))
|
||||
((= i len)
|
||||
v)
|
||||
(string-set! v i (car l))))))
|
||||
|
||||
(define (string . objs)
|
||||
(list->string objs))
|
||||
|
||||
|
|
Loading…
Reference in New Issue