racket/collects/math/private/array/mutable-array.rkt
Neil Toronto 3670916a11 Initial commit for `math/array' documentation; about 65% finished
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
2012-11-24 22:13:24 -07:00

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)]))