Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (28 sloc) 0.754 kb
#lang scheme/base
(require "unet.ss")
(define-unet define-constructors
(import make-vector
for/vector
in-vector
vector-length)
(export vector-ones
vector-zeros
vector-copy
vector-reverse)
(define (vector-ones length)
(make-vector length 1))
(define (vector-zeros length)
(make-vector length 0))
(define (vector-copy v)
(for/vector ([i (vector-length v)]
[x (in-vector v)])
x))
(define (vector-reverse v)
(define n (vector-length v))
(if (zero? n)
v
(for/vector ([i n]
[x (in-vector v (sub1 n) -1 -1)])
x)))
)
(provide define-constructors)
Jump to Line
Something went wrong with that request. Please try again.