(aget arr idx & more)
Works just like clojure.core/aget, but with static checking of the array type to detect type errors at compile time.
Works just like clojure.core/aget, but with static checking of the array type to detect type errors at compile time.
(array-type? t)
Returns true if and only if the given type is an array type.
Returns true if and only if the given type is an array type.
(array? x)
Returns true if and only if the given object is an array.
Returns true if and only if the given object is an array.
(aset arr idx & idxv)
Works just like clojure.core/aset, but with static checking of the array type to detect type errors at compile time.
Works just like clojure.core/aset, but with static checking of the array type to detect type errors at compile time.
(cast type-desc expr)
Casts the given expression expr to the array type denoted by type-desc.
This macro only has the compile-time effect and does nothing at runtime.
Casts the given expression expr to the array type denoted by type-desc. This macro only has the compile-time effect and does nothing at runtime.
(def name arr)
(def name docstr arr)
The macro version of def dedicated to arrays. This macro can be used as a drop-in replacement for Clojure's def. Unlike the ordinary def form, (sweet-array.core/def <var> <init>) infers the static type of <init> and implicitly adds the inferred type as the type hint for <var>. Throws an error at macro expansion time if the type of <init> cannot be statically inferred or if the inferred type is not an array type.
The macro version of def dedicated to arrays. This macro can be used as a drop-in replacement for Clojure's def. Unlike the ordinary def form, (sweet-array.core/def <var> <init>) infers the static type of <init> and implicitly adds the inferred type as the type hint for <var>. Throws an error at macro expansion time if the type of <init> cannot be statically inferred or if the inferred type is not an array type.
(install-array-literals!)
Experimental - Enables array literals globally.
This function is intended for use in user.clj
or other initialization code to
enable array literals. Note: This function has no effect when used from the REPL.
Use use-array-literals!
to enable array literals interactively in the REPL.
Experimental - Enables array literals globally. This function is intended for use in `user.clj` or other initialization code to enable array literals. Note: This function has no effect when used from the REPL. Use `use-array-literals!` to enable array literals interactively in the REPL.
(instance? type-desc x)
Evaluates x and tests if it is an instance of the array type denoted by type-desc.
Evaluates x and tests if it is an instance of the array type denoted by type-desc.
(into-array type-desc coll)
(into-array type-desc xform coll)
Converts the given collection (seqable) to an array of the type denoted by type-desc. A transducer may be supplied.
Converts the given collection (seqable) to an array of the type denoted by type-desc. A transducer may be supplied.
(new type-desc & args)
Creates an array of the type denoted by type-desc.
The macro has two forms:
Creates an array of the type denoted by type-desc. The macro has two forms: - (new [T] n): produce an array of type T of size n - (new [T] [e_1 ... e_n]): produce an array of type T of size n initialized with elements e_1, ..., e_n.
(type desc)
Returns the class object that represents the array type denoted by type-desc.
Returns the class object that represents the array type denoted by type-desc.
(use-array-literals!)
Experimental - Enables array literals for the current REPL session.
Use this function when working in the REPL. Note: This function will throw an error
if used in user.clj
. If you need to enable array literals for code written
in files, use install-array-literals!
instead.
Experimental - Enables array literals for the current REPL session. Use this function when working in the REPL. Note: This function will throw an error if used in `user.clj`. If you need to enable array literals for code written in files, use `install-array-literals!` instead.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close