
Do not use ^Integer etc.ĭon’t rush to unchecked math unless you want truncating operations. (let …) is the correct way to get a primitive local. Instead, use the let technique shown to place args in primitive locals if they need to participate in primitive arithmetic in the body. non-destructively) processing one or more arrays in order to produce a new array or aggregate value respectively.Īll arguments are passed to Clojure fns as objects, so there’s no point to putting arbitrary primitive type hints on fn args (excepting primitive array type hints, and long and double as noted). which produce int, long, etc.Ī set of "unchecked" operations for utmost performing, but potentially unsafe, integer (int/long) ops: unchecked-multiply unchecked-dec unchecked-inc unchecked-negate unchecked-add unchecked-subtract unchecked-remainder unchecked-divideĪ dynamic var to automatically swap safe operations with unchecked operations: *unchecked-math*Īmap and areduce macros for functionally (i.e. The num coercion function boxes primitives to force generic arithmeticĪrray cast functions ints longs, etc. produce primitives when consumer can take primitive Type hints for primitive arrays - ^ints, ^floats, etc.Ĭoercion ops int, float, etc. Recur forms that rebind primitive locals do so without boxing, and do type-checking for same primitive type.Īrithmetic (+,-,*,/,inc,dec,>= etc) is overloaded for primitive types where semantics are same.Īget / aset are overloaded for arrays of primitivesĪclone, alength functions for arrays of primitivesĬonstructor functions for primitive arrays: float-array, int-array, etc.

Let/ loop-bound locals can be of primitive types, having the inferred, possibly primitive type of their init-form.
