       result = step(result, x)
     result
 
-  arrayWith: (a, i, x) -> a[...i].concat([x], a[i+1..])
-
-  arrayWithInsertion: (a, i, x) -> a[...i].concat([x], a[i..])
-
-  arrayWithout: (a, i) -> a[...i].concat(a[i+1..])
+  arrayWith: (a, i, x) ->
+    (if j == i then x else a[j]) for j in [0...a.length]
+
+  arrayWithInsertion: (a, i, x) ->
+    (if j < i then a[j] else if j > i then a[j-1] else x) for j in [0..a.length]
+
+  arrayWithout: (a, i) ->
+    a[j] for j in [0...a.length] when j != i
 
 
   mask: (key, shift) -> (key >> shift) & 0x1f

# A dense interior node with room for 32 entries.
class ArrayNode
  constructor: (baseTable, i, node, @size) ->
    @table = baseTable[0..]
    @table[i] = node

  each: (func) ->
    for node in @table

# changed node. This has therefore to be assured by the caller, and
# ultimately by the collection classes themselves.
#
# This version: Copyright (c) 2010 Olaf Delgado-Friedrichs (odf@github.com)
#
# Original copyright and licensing:
