support strings
This commit is contained in:
parent
27322a3c80
commit
9ab446ab92
|
@ -1 +1 @@
|
||||||
Subproject commit c3acc4cb44bcf3baf9c50bb4667ad20c77660c3f
|
Subproject commit 5331d6f23c7df61e75c00879cd270ea1c4d7df85
|
|
@ -140,10 +140,14 @@
|
||||||
vector->list)
|
vector->list)
|
||||||
|
|
||||||
(export string?
|
(export string?
|
||||||
|
make-string
|
||||||
string-length
|
string-length
|
||||||
string-ref
|
string-ref
|
||||||
|
string-set!
|
||||||
string-copy
|
string-copy
|
||||||
|
string-copy!
|
||||||
string-append
|
string-append
|
||||||
|
string-fill!
|
||||||
string=?
|
string=?
|
||||||
string<?
|
string<?
|
||||||
string>?
|
string>?
|
||||||
|
|
|
@ -374,47 +374,50 @@
|
||||||
(reverse res))
|
(reverse res))
|
||||||
(set! res (cons (string-ref string i) res)))))
|
(set! res (cons (string-ref string i) res)))))
|
||||||
|
|
||||||
;; (define (list->string list)
|
(define (list->string list)
|
||||||
;; (let ((len (length list)))
|
(let ((len (length list)))
|
||||||
;; (let ((v (make-string len)))
|
(let ((v (make-string len)))
|
||||||
;; (do ((i 0 (+ i 1))
|
(do ((i 0 (+ i 1))
|
||||||
;; (l list (cdr l)))
|
(l list (cdr l)))
|
||||||
;; ((= i len)
|
((= i len)
|
||||||
;; v)
|
v)
|
||||||
;; (string-set! v i (car l))))))
|
(string-set! v i (car l))))))
|
||||||
|
|
||||||
;; (define (string . objs)
|
(define (string . objs)
|
||||||
;; (list->string objs))
|
(list->string objs))
|
||||||
|
|
||||||
(export ;string
|
|
||||||
string->list
|
|
||||||
;list->string
|
|
||||||
(rename string-copy substring))
|
|
||||||
|
|
||||||
(export string?
|
(export string?
|
||||||
|
string
|
||||||
|
make-string
|
||||||
string-length
|
string-length
|
||||||
string-ref
|
string-ref
|
||||||
|
string-set!
|
||||||
string-copy
|
string-copy
|
||||||
|
string-copy!
|
||||||
string-append
|
string-append
|
||||||
|
string-fill!
|
||||||
string=?
|
string=?
|
||||||
string<?
|
string<?
|
||||||
string>?
|
string>?
|
||||||
string<=?
|
string<=?
|
||||||
string>=?)
|
string>=?
|
||||||
|
string->list
|
||||||
|
list->string
|
||||||
|
(rename string-copy substring))
|
||||||
|
|
||||||
;; 6.8. Vectors
|
;; 6.8. Vectors
|
||||||
|
|
||||||
(define (vector . objs)
|
(define (vector . objs)
|
||||||
(list->vector objs))
|
(list->vector objs))
|
||||||
|
|
||||||
;; (define (vector->string . args)
|
(define (vector->string . args)
|
||||||
;; (list->string (apply vector->list args)))
|
(list->string (apply vector->list args)))
|
||||||
|
|
||||||
(define (string->vector . args)
|
(define (string->vector . args)
|
||||||
(list->vector (apply string->list args)))
|
(list->vector (apply string->list args)))
|
||||||
|
|
||||||
(export vector
|
(export vector
|
||||||
;vector->string
|
vector->string
|
||||||
string->vector)
|
string->vector)
|
||||||
|
|
||||||
(export vector?
|
(export vector?
|
||||||
|
@ -450,12 +453,12 @@
|
||||||
(define (bytevector . objs)
|
(define (bytevector . objs)
|
||||||
(list->bytevector objs))
|
(list->bytevector objs))
|
||||||
|
|
||||||
;; (define (utf8->string v . opts)
|
(define (utf8->string v . opts)
|
||||||
;; (let ((start (if (pair? opts) (car opts) 0))
|
(let ((start (if (pair? opts) (car opts) 0))
|
||||||
;; (end (if (>= (length opts) 2)
|
(end (if (>= (length opts) 2)
|
||||||
;; (cadr opts)
|
(cadr opts)
|
||||||
;; (bytevector-length v))))
|
(bytevector-length v))))
|
||||||
;; (list->string (map integer->char (bytevector->list v start end)))))
|
(list->string (map integer->char (bytevector->list v start end)))))
|
||||||
|
|
||||||
(define (string->utf8 s . opts)
|
(define (string->utf8 s . opts)
|
||||||
(let ((start (if (pair? opts) (car opts) 0))
|
(let ((start (if (pair? opts) (car opts) 0))
|
||||||
|
@ -467,7 +470,7 @@
|
||||||
(export bytevector
|
(export bytevector
|
||||||
bytevector->list
|
bytevector->list
|
||||||
list->bytevector
|
list->bytevector
|
||||||
;; utf8->string
|
utf8->string
|
||||||
string->utf8)
|
string->utf8)
|
||||||
|
|
||||||
(export bytevector?
|
(export bytevector?
|
||||||
|
@ -480,8 +483,8 @@
|
||||||
|
|
||||||
;; 6.10. Control features
|
;; 6.10. Control features
|
||||||
|
|
||||||
;; (define (string-map f . strings)
|
(define (string-map f . strings)
|
||||||
;; (list->string (apply map f (map string->list strings))))
|
(list->string (apply map f (map string->list strings))))
|
||||||
|
|
||||||
(define (string-for-each f . strings)
|
(define (string-for-each f . strings)
|
||||||
(apply for-each f (map string->list strings)))
|
(apply for-each f (map string->list strings)))
|
||||||
|
@ -492,7 +495,7 @@
|
||||||
(define (vector-for-each f . vectors)
|
(define (vector-for-each f . vectors)
|
||||||
(apply for-each f (map vector->list vectors)))
|
(apply for-each f (map vector->list vectors)))
|
||||||
|
|
||||||
(export ;string-map
|
(export string-map
|
||||||
string-for-each
|
string-for-each
|
||||||
vector-map
|
vector-map
|
||||||
vector-for-each)
|
vector-for-each)
|
||||||
|
|
Loading…
Reference in New Issue