syntax
( Listof* A)
syntax
( Vectorof* A)
procedure
( list->array lst)→(Array A)
ds:In-Indexesprocedure
( array->list arr)→(Listof A)
The two-argument variant of list->array assumes the elements in lst are in row-major order.
For array->list , if arr has no axes or more than one axis, it is (conceptually) flattened before being converted to a list.
- : #(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes Positive-Byte))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(array #[1 2 3])
- : #(struct:Array
(Indexes
Index
(Boxof Boolean)
(-> Void)
(-> Indexes
(U (List One Positive-Byte Positive-Byte)
(List Positive-Byte Positive-Byte))))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(array #['(1 2 3) '(4 5)])
- : #(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes Positive-Byte))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(array #[#[1 2] #[3 4]])
- : (Listof Positive-Byte)
'(1 2 3)
- : (Listof Positive-Byte)
'(10)
- : (Listof Positive-Byte)
'(1 2 3 4 5 6)
The arrays returned by list->array are always strict.
procedure
( vector->array vec)→(Mutable-Array A)
ds:In-Indexesprocedure
( array->vector arr)→(Vectorof A)
- : #(struct:Mutable-Array
(Indexes
Index
(Boxof Boolean)
(-> Void)
(-> Indexes Integer)
(-> Indexes Integer Void)
(Vectorof Integer))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-mutable-array.rkt:14:13 prop:custom-write>)
(mutable-array #[1 2 3])
- : #(struct:Mutable-Array
(Indexes
Index
(Boxof Boolean)
(-> Void)
(-> Indexes
(U (List One Positive-Byte Positive-Byte)
(List Positive-Byte Positive-Byte)))
(-> Indexes
(U (List One Positive-Byte Positive-Byte)
(List Positive-Byte Positive-Byte))
Void)
(Vectorof
(U (List One Positive-Byte Positive-Byte)
(List Positive-Byte Positive-Byte))))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-mutable-array.rkt:14:13 prop:custom-write>)
(mutable-array #['(1 2 3) '(4 5)])
- : #(struct:Mutable-Array
(Indexes
Index
(Boxof Boolean)
(-> Void)
(-> Indexes Integer)
(-> Indexes Integer Void)
(Vectorof Integer))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-mutable-array.rkt:14:13 prop:custom-write>)
(mutable-array #[#[1 2] #[3 4]])
- : (Vectorof Integer)
'#(1 2 3)
- : (Vectorof Integer)
'#(10)
- : (Vectorof Integer)
'#(1 2 3 4 5 6)
- : #(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes Symbol))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(array 'singleton)
- : #(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes Byte))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(mutable-array #[0 1 2 3])
- : #(struct:Array
(Indexes
Index
(Boxof Boolean)
(-> Void)
(-> Indexes (Listof Nonnegative-Real)))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(mutable-array #[#['(5) '(2 3)] #['(4.0) '(1.4 0.2 9.3)]])
There is no well-typed Typed Racket function that behaves like list*->array but does not require pred?. Without an element predicate, there is no way to prove to the type checker that list*->array ’s implementation correctly distinguishes elements from rows.
The arrays returned by list*->array are always strict.
procedure
( array->list* arr)→(Listof* A)
procedure
( vector*->array vecspred?)→(Mutable-Array A)
- : #(struct:Mutable-Array
(Indexes
Index
(Boxof Boolean)
(-> Void)
(-> Indexes Symbol)
(-> Indexes Symbol Void)
(Vectorof Symbol))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-mutable-array.rkt:14:13 prop:custom-write>)
(mutable-array 'singleton)
- : #(struct:Mutable-Array
(Indexes
Index
(Boxof Boolean)
(-> Void)
(-> Indexes Byte)
(-> Indexes Byte Void)
(Vectorof Byte))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-mutable-array.rkt:14:13 prop:custom-write>)
(mutable-array #[0 1 2 3])
procedure
( array->vector* arr)→(Vectorof* A)
procedure
( array-list->array arrs[axis])→(Array A)
- : #(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes Byte))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(array #[0 1 2 3])
array-list->array: expected axis Index <= 0; given 1
- : #(struct:Array
(Indexes
Index
(Boxof Boolean)
(-> Void)
(-> Indexes (U 'a 'b 'c 'd Byte)))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(array #[#[0 1 2 3] #['a 'b 'c 'd]])
- : #(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes (U '! Byte)))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(array #[#[0 1 2 3] #['! '! '! '!]])
- : #(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes (U '! Byte)))
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:build/user/8.18/pkgs/math-lib/math/private/array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>)
(array #[#[0 '!] #[1 '!] #[2 '!] #[3 '!]])
For a similar function that does not increase the dimension of the broadcast arrays, see array-append* .
procedure
( array->array-list arr[axis])→(Listof (Array A))
- : (Listof
#(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes Byte))
#<syntax:.../array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:.../array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:.../array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>))
(list (array 0) (array 1) (array 2) (array 3))
- : (Listof
#(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes Positive-Byte))
#<syntax:.../array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:.../array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:.../array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>))
(list (array #[1 2]) (array #[10 20]))
- : (Listof
#(struct:Array
(Indexes Index (Boxof Boolean) (-> Void) (-> Indexes Positive-Byte))
#<syntax:.../array/typed-array-struct.rkt:56:13 prop:equal+hash>
#<syntax:.../array/typed-array-struct.rkt:55:13 prop:custom-write>
#<syntax:.../array/typed-array-struct.rkt:54:13 prop:custom-print-quotable>))
(list (array #[1 10]) (array #[2 20]))
array->array-list: expected axis Index < 0; given 0
parameter
procedure
( print-array arrnameportmode)→Any
name:Symbolport:Output-Port
(my-cool-array #[0 1 2 3])