update benz (conversion functions)

This commit is contained in:
Yuichi Nishiwaki 2014-09-12 21:21:29 +09:00
parent b84004770a
commit 22a04a59a2
3 changed files with 19 additions and 44 deletions

@ -1 +1 @@
Subproject commit a2f0d7f7ac4647e3ffbe488169300abb5fedbf16
Subproject commit 0f2a172ffcdce1e9732dd157f343b2aa0e1960db

View File

@ -124,15 +124,19 @@
assoc)
(export bytevector?
bytevector
make-bytevector
bytevector-length
bytevector-u8-ref
bytevector-u8-set!
bytevector-copy
bytevector-copy!
bytevector-append)
bytevector-append
bytevector->list
list->bytevector)
(export vector?
vector
make-vector
vector-length
vector-ref
@ -142,9 +146,12 @@
vector-append
vector-fill!
list->vector
vector->list)
vector->list
string->vector
vector->string)
(export string?
string
make-string
string-length
string-ref

View File

@ -380,9 +380,6 @@
;; 6.7. Strings
(define (string . objs)
(list->string objs))
(export string?
string
make-string
@ -392,32 +389,20 @@
string-copy
string-copy!
string-append
(rename string-copy substring)
string-fill!
string->list
list->string
string=?
string<?
string>?
string<=?
string>=?
string->list
list->string
(rename string-copy substring))
string>=?)
;; 6.8. Vectors
(define (vector . objs)
(list->vector objs))
(define (vector->string . args)
(list->string (apply vector->list args)))
(define (string->vector . args)
(list->vector (apply string->list args)))
(export vector
vector->string
string->vector)
(export vector?
vector
make-vector
vector-length
vector-ref
@ -427,28 +412,11 @@
vector-append
vector-fill!
list->vector
vector->list)
vector->list
string->vector
vector->string)
;; 6.9. bytevector
(define (bytevector->list v start end)
(do ((i start (+ i 1))
(res '()))
((= i end)
(reverse res))
(set! res (cons (bytevector-u8-ref v i) res))))
(define (list->bytevector list)
(let ((len (length list)))
(let ((v (make-bytevector len)))
(do ((i 0 (+ i 1))
(l list (cdr l)))
((= i len)
v)
(bytevector-u8-set! v i (car l))))))
(define (bytevector . objs)
(list->bytevector objs))
;; 6.9. Bytevectors
(define (utf8->string v . opts)
(let ((start (if (pair? opts) (car opts) 0))