mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 01:07:34 +02:00
Added bytevector-copy
This commit is contained in:
parent
2aa9276132
commit
c1b98df688
2 changed files with 7 additions and 2 deletions
|
@ -22,6 +22,6 @@
|
|||
(let ((x 1))
|
||||
(define a #u8(1 2 3 4 5))
|
||||
(define b #(1 2 3 4 5))
|
||||
(write (Cyc-bytevector-copy a 2 4)) ; =⇒ #u8(3 4)
|
||||
(write (bytevector-copy a 2 4)) ; =⇒ #u8(3 4)
|
||||
(write b)
|
||||
)
|
||||
|
|
|
@ -152,6 +152,7 @@
|
|||
inexact
|
||||
eof-object
|
||||
syntax-error
|
||||
bytevector-copy
|
||||
|
||||
;;;;
|
||||
; Possibly missing functions:
|
||||
|
@ -159,7 +160,6 @@
|
|||
; ; byte vectors are not implemented yet:
|
||||
; bytevector
|
||||
; bytevector-append
|
||||
; bytevector-copy
|
||||
; bytevector-copy!
|
||||
; bytevector-length
|
||||
; bytevector-u8-ref
|
||||
|
@ -700,6 +700,11 @@
|
|||
(loop (+ i 1)
|
||||
(cons (vector-ref vec i) lst))))))
|
||||
(loop start '())))
|
||||
(define (bytevector-copy bv . opts)
|
||||
(letrec ((len (bytevector-length bv))
|
||||
(start (if (> (length opts) 0) (car opts) 0))
|
||||
(end (if (> (length opts) 1) (cadr opts) len)))
|
||||
(Cyc-bytevector-copy bv start end)))
|
||||
(define (vector->string vec . opts)
|
||||
(let ((lst (apply vector->list (cons vec opts))))
|
||||
(list->string lst)))
|
||||
|
|
Loading…
Add table
Reference in a new issue