                (next args))
          all-indexes
          (cond (= ndims 1)
-               `[~(first args)] 
+               `[~(first args)]
                (= ndims 2)
                `[~(first args) ~(second args)]
                :else
-               (first args))]
-    `(let ~(cond
-             (= ndims 1)
-             `[~row ~(first args)]
+               (first args))
+         type-hints
+         (make-index-type-hints
+           (cond (= ndims 1)
+                 (take 1 args)
+                 (= ndims 2)
+                 (take 2 args)
+                 :else
+                 []))
+         bindings
+         (-> (cond (= ndims 1)
+             `[~row-sym ~(first args)]
              (= ndims 2)
-             `[~row ~(first args)
-               ~col ~(second args)]
-             :else 
-             `[~indexes ~(first args)])
+             `[~row-sym ~(first args)
+               ~col-sym ~(second args)]
+             :else
+             `[~indexes-sym ~(first args)])
+             (concat type-hints)
+             (vec))]
+    `(let ~bindings
        (if ~check-clause
          (do ~@body)
          (error


(extend-protocol mp/PIndexedAccess
  NDArray
  (get-1d [m ^long row]
    (with-check-shape
      1 [m m] row
      (.get m row)))
  (get-2d [m ^long row ^long col]
    (with-check-shape
      2 [m m] row col
      (.get m row col)))


(extend-protocol mp/PIndexedSettingMutable
  NDArray
  (set-1d! [m row ^double v]
    (with-check-shape
      1 [m m] row
      (.set m row v)))
  (set-2d! [m row col ^double v]
    (with-check-shape
      2 [m m] row col
      (.set m row col v)))
  (set-nd! [m indexes ^double v]
    (with-check-shape
      (count indexes) [m m] indexes
      (.set m (long-array indexes) v))))
