
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.
41 lines
1.3 KiB
Racket
41 lines
1.3 KiB
Racket
#lang racket/base
|
|
|
|
(require typed/untyped-utils
|
|
(except-in "typed-array-indexing.rkt"
|
|
array-ref
|
|
array-set!
|
|
array-indexes-ref
|
|
array-indexes-set!
|
|
slice-indexes-array))
|
|
|
|
(require/untyped-contract
|
|
(begin (require "array-struct.rkt"
|
|
"utils.rkt"
|
|
"typed-array-indexing.rkt"))
|
|
"typed-array-indexing.rkt"
|
|
[array-ref (All (A) ((Array A) (Vectorof Integer) -> A))]
|
|
[array-set! (All (A) ((Settable-Array A) (Vectorof Integer) A -> Void))]
|
|
[array-indexes-ref (All (A) ((Array A) (Array (Vectorof Integer)) -> (Array A)))]
|
|
[array-indexes-set! (All (A) ((Settable-Array A) (Array (Vectorof Integer)) (Array A) -> Void))]
|
|
[slice-indexes-array ((Vectorof Integer) (Listof Slice-Spec) -> (Array Indexes))])
|
|
|
|
(provide
|
|
array-ref
|
|
array-set!
|
|
unsafe-array-ref
|
|
unsafe-array-set!
|
|
;; Indexing by array of indexes
|
|
array-indexes-ref
|
|
array-indexes-set!
|
|
;; Slicing
|
|
(rename-out [-Slice Slice]
|
|
[-Slice-Dots Slice-Dots]
|
|
[-Slice-New-Axis Slice-New-Axis])
|
|
Slice-Spec
|
|
:: slice? slice-start slice-end slice-step slice->range-values
|
|
::... slice-dots?
|
|
::new slice-new-axis? slice-new-axis-length
|
|
array-slice-ref
|
|
slice-indexes-array
|
|
array-slice-set!)
|