
in the original GitHub fork: https://github.com/ntoronto/racket Some things about this are known to be broken (most egregious is that the array tests DO NOT RUN because of a problem in typed/rackunit), about half has no coverage in the tests, and half has no documentation. Fixes and docs are coming. This is committed now to allow others to find errors and inconsistency in the things that appear to be working, and to give the author a (rather incomplete) sense of closure.
35 lines
976 B
Racket
35 lines
976 B
Racket
#lang racket/base
|
|
|
|
(require typed/untyped-utils
|
|
(for-syntax racket/base syntax/parse)
|
|
"array-syntax.rkt"
|
|
(except-in "typed-mutable-array.rkt"
|
|
make-mutable-array))
|
|
|
|
(require/untyped-contract
|
|
(begin (require "typed-mutable-array.rkt"))
|
|
"typed-mutable-array.rkt"
|
|
[make-mutable-array (All (A) ((Vectorof Integer) (Vectorof A) -> (Mutable-Array A)))])
|
|
|
|
(provide
|
|
;; Mutable-Array
|
|
Mutable-Array
|
|
mutable-array?
|
|
mutable-array-data
|
|
make-mutable-array
|
|
unsafe-mutable-array
|
|
mutable-array-copy
|
|
mutable-array
|
|
;; Conversion
|
|
array->mutable-array
|
|
array-strict
|
|
flat-vector->matrix)
|
|
|
|
(define-syntax (mutable-array stx)
|
|
(syntax-parse stx
|
|
[(_ e:expr)
|
|
(syntax/loc stx (array/syntax mutable-array vector make-mutable-array e))]
|
|
[(_ e:expr T:expr)
|
|
(syntax/loc stx (array/syntax mutable-array (inst vector T) make-mutable-array e))]
|
|
[_:id (raise-syntax-error 'mutable-array "not allowed as an expression" stx)]))
|