Skip to content

Instantly share code, notes, and snippets.

View juskrey's full-sized avatar

Stanislav Yurin juskrey

View GitHub Profile
@juskrey
juskrey / array_type.clj
Created April 5, 2020 09:53 — forked from Chouser/array_type.clj
Clojure array type hint
(defn array-type
"Return a string representing the type of an array with dims
dimentions and an element of type klass.
For primitives, use a klass like Integer/TYPE
Useful for type hints of the form: ^#=(array-type String) my-str-array"
([klass] (array-type klass 1))
([klass dims]
(.getName (class
(apply make-array
(if (symbol? klass) (eval klass) klass)