     p = @offset
     indices = for axis in @shape then 0
     loop
-      f @data[p]
+      f @data[p], indices
       axis = @shape.length - 1
       while axis >= 0 and indices[axis] + 1 is @shape[axis]
         p -= indices[axis] * @stride[axis]

    q = a.offset
    indices = for axis in @shape then 0
    loop
      f @data[p], a.data[q]
      axis = @shape.length - 1
      while axis >= 0 and indices[axis] + 1 is @shape[axis]
        p -= indices[axis] * @stride[axis]

  map: (f) ->
    assert typeof f is 'function'
    data = []
    @each (x, indices) -> data.push f x, indices
    new APLArray data, @shape

  map2: (a, f) ->
    assert a instanceof APLArray
    assert typeof f is 'function'
    data = []
    @each2 a, (x, y, indices) -> data.push f x, y, indices
    new APLArray data, @shape

  toArray: (limit = Infinity) ->
