
Replaced pointwise operators with macros that expand to applications of `array-map'; allows more precise return types and reduces compilation time Changed literal array syntax to use #() to delimit rows instead of [] (still suggest using square parens, though) Minor refactoring Fixed a macro so that the only problem with "array-tests.rkt" now is that typed/rackunit is b0rked
36 lines
1020 B
Racket
36 lines
1020 B
Racket
#lang racket/base
|
|
|
|
(require typed/untyped-utils
|
|
typed/racket/base
|
|
(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 #:literals (:)
|
|
[(_ 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)]))
|