string conversion functions

This commit is contained in:
Yuichi Nishiwaki 2014-09-10 20:10:09 +09:00
parent 65a1b0f5af
commit 96609de180
3 changed files with 3 additions and 21 deletions

@ -1 +1 @@
Subproject commit 8f93ddd87b1f2b705c204f51ba1365a6b7a7f547
Subproject commit c6b46ae2acba046f2c1c3f26e862134de0df846a

View File

@ -154,6 +154,8 @@
string-copy!
string-append
string-fill!
string->list
list->string
string=?
string<?
string>?

View File

@ -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))