mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 17:27:33 +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))
|
(let ((x 1))
|
||||||
(define a #u8(1 2 3 4 5))
|
(define a #u8(1 2 3 4 5))
|
||||||
(define b #(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)
|
(write b)
|
||||||
)
|
)
|
||||||
|
|
|
@ -152,6 +152,7 @@
|
||||||
inexact
|
inexact
|
||||||
eof-object
|
eof-object
|
||||||
syntax-error
|
syntax-error
|
||||||
|
bytevector-copy
|
||||||
|
|
||||||
;;;;
|
;;;;
|
||||||
; Possibly missing functions:
|
; Possibly missing functions:
|
||||||
|
@ -159,7 +160,6 @@
|
||||||
; ; byte vectors are not implemented yet:
|
; ; byte vectors are not implemented yet:
|
||||||
; bytevector
|
; bytevector
|
||||||
; bytevector-append
|
; bytevector-append
|
||||||
; bytevector-copy
|
|
||||||
; bytevector-copy!
|
; bytevector-copy!
|
||||||
; bytevector-length
|
; bytevector-length
|
||||||
; bytevector-u8-ref
|
; bytevector-u8-ref
|
||||||
|
@ -700,6 +700,11 @@
|
||||||
(loop (+ i 1)
|
(loop (+ i 1)
|
||||||
(cons (vector-ref vec i) lst))))))
|
(cons (vector-ref vec i) lst))))))
|
||||||
(loop start '())))
|
(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)
|
(define (vector->string vec . opts)
|
||||||
(let ((lst (apply vector->list (cons vec opts))))
|
(let ((lst (apply vector->list (cons vec opts))))
|
||||||
(list->string lst)))
|
(list->string lst)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue