mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 22:29:16 +02:00
adding bytevector procedure
This commit is contained in:
parent
dd168e5506
commit
ed443d42a2
2 changed files with 8 additions and 1 deletions
|
@ -12,7 +12,7 @@
|
||||||
(srfi 9) (srfi 11) (srfi 39))
|
(srfi 9) (srfi 11) (srfi 39))
|
||||||
(export
|
(export
|
||||||
* + - ... / < <= = => > >= _ abs and append apply assoc assq assv begin
|
* + - ... / < <= = => > >= _ abs and append apply assoc assq assv begin
|
||||||
binary-port? boolean? boolean=? bytevector-append
|
binary-port? boolean? boolean=? bytevector bytevector-append
|
||||||
bytevector-copy bytevector-copy! bytevector-length
|
bytevector-copy bytevector-copy! bytevector-length
|
||||||
bytevector-u8-ref bytevector-u8-set! bytevector? caar cadr
|
bytevector-u8-ref bytevector-u8-set! bytevector? caar cadr
|
||||||
call-with-current-continuation call-with-port call-with-values
|
call-with-current-continuation call-with-port call-with-values
|
||||||
|
|
|
@ -165,6 +165,13 @@
|
||||||
(define (string->vector vec . o)
|
(define (string->vector vec . o)
|
||||||
(list->vector (apply string->list vec o)))
|
(list->vector (apply string->list vec o)))
|
||||||
|
|
||||||
|
(define (bytevector . args)
|
||||||
|
(let* ((len (length args))
|
||||||
|
(res (make-bytevector len)))
|
||||||
|
(do ((i 0 (+ i 1)) (ls args (cdr ls)))
|
||||||
|
((null? ls) res)
|
||||||
|
(bytevector-u8-set! res i (car ls)))))
|
||||||
|
|
||||||
(define (bytevector-copy! to at from . o)
|
(define (bytevector-copy! to at from . o)
|
||||||
(let* ((start (if (pair? o) (car o) 0))
|
(let* ((start (if (pair? o) (car o) 0))
|
||||||
(end (if (and (pair? o) (pair? (cdr o)))
|
(end (if (and (pair? o) (pair? (cdr o)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue