/// Function replace_at //////////////////////////////////////////////////  (seq:Sequence, index:Num, sub) ↦ Array  Replaces the item at index by `sub`.
178742
function replace_at(seq, index, sub) { var result
        result = copy(seq)
        result[index] = sub
        return result
    }
1178664
function arrayCopyWithin (array, target, start, end) {
  if (baseExports.isArray(array) && array.copyWithin) {
    return array.copyWithin(target, start, end)
  }
  var replaceIndex, replaceArray
  var targetIndex = target >> 0
  var startIndex = start >> 0
  var len = array.length
  var endIndex = arguments.length > 3 ? end >> 0 : len
  if (targetIndex < len) {
    targetIndex = targetIndex >= 0 ? targetIndex : len + targetIndex
    if (targetIndex >= 0) {
      startIndex = startIndex >= 0 ? startIndex : len + startIndex
      endIndex = endIndex >= 0 ? endIndex : len + endIndex
      if (startIndex < endIndex) {
        for (replaceIndex = 0, replaceArray = array.slice(startIndex, endIndex); targetIndex < len; targetIndex++) {
          if (replaceArray.length <= replaceIndex) {
            break
          }
          array[targetIndex] = replaceArray[replaceIndex++]
        }
      }
    }
  }
  return array
}
164552
function remove$1 (arr, item) {
	  if (arr.length) {
	    var index = arr.indexOf(item);
	    if (index > -1) {
	      return arr.splice(index, 1)
	    }
	  }
	}
958266
function(str, match) {
            var replacement;

            // Loop through all subs. Example: ${a.b.c}
            // 0 -> replacement = context[a];
            // 1 -> replacement = context[a][b];
            // 2 -> replacement = context[a][b][c];
            var subs = match.split(/\.+/);
            for (var i=0; i< subs.length; i++) {
                if (i == 0) {
                    replacement = context;
                }
                if (replacement === undefined) {
                    break;
                }
                replacement = replacement[subs[i]];
            }

            if(typeof replacement == "function") {
                replacement = args ?
                    replacement.apply(null, args) :
                    replacement();
            }

            // If replacement is undefined, return the string 'undefined'.
            // This is a workaround for a bugs in browsers not properly 
            // dealing with non-participating groups in regular expressions:
            // http://blog.stevenlevithan.com/archives/npcg-javascript
            if (typeof replacement == 'undefined') {
                return 'undefined';
            } else {
                return replacement; 
            }
        }
1030202
def greedy_replace(self, seq):
        '''
        
        '''
        if not self._suffix_links_set:
            self._set_suffix_links()
        # start at the root
        current = self.root
        buffered = ''
        outstr = ''
        for char in seq:
            while char not in current:
                if current.has_dict_suffix:
                    current = current.dict_suffix
                    outstr += buffered[:-current.depth]
                    outstr += current.value
                    buffered = ''
                    current = self.root
                    break
                elif current.has_suffix:
                    current = current.suffix
                    if current.depth:
                        outstr += buffered[:-current.depth]
                        buffered = buffered[-current.depth:]
                    else:
                        outstr += buffered
                        buffered = ''
                        break
                else:
                    current = self.root
                    outstr += buffered
                    buffered = ''
                    break
            if char in current:
                buffered += char
                current = current[char]
                if current.has_value:
                    outstr += buffered[:-current.depth]
                    outstr += current.value
                    buffered = ''
                    current = self.root
            else:
                assert current is self.root
                outstr += buffered + char
                buffered = ''
        if current.has_dict_suffix:
            current = current.dict_suffix
            outstr += buffered[:-current.depth]
            outstr += current.value
        else:
            outstr += buffered
        return outstr
431428
function arrayFunction(item, index) {
      return function(data, cb) {
        if (iterator.length === 2) {
          iterator(item, cb);
        } else if (iterator.length === 3) {
          iterator(item, index, cb);
        } else {
          iterator(item, index, data, cb);
        }
      };
    }
181309
function replaceAt(items, item, index) {
  var copy = items.slice();
  copy.splice(index, 1, item);
  return copy;
}
1110611
function insertSorted(arr, item, comparator) {
  var idx = binarySearch(arr, item, comparator);
  arr.splice(idx, 0, item);
}
443971
function subst(array &$old,$new) {
		if (is_string($new))
			$new=[$new];
		foreach ($new as $hdr) {
			$old=preg_grep('/'.preg_quote(strstr($hdr,':',TRUE),'/').':.+/',
				$old,PREG_GREP_INVERT);
			array_push($old,$hdr);
		}
	}
1230767
function sub(seq, from, to) {
  var f = Array.isArray(seq) ? seq.slice : seq.substring
  return to == null ? f.call(seq, from) : f.call(seq, from, to)
}
477692
function updateSingleArray(aOrig, aAdditional, bRemove) {
		if (!aAdditional) {
			return;
		}

		for (var i = 0; i < aAdditional.length; i++) {
			var iIndex = aOrig.indexOf(aAdditional[i]);
			if (iIndex > -1 && bRemove) {
				aOrig.splice(iIndex, 1);
			} else if (iIndex === -1 && !bRemove) {
				aOrig.push(aAdditional[i]);
			}
		}
	}
52597
function replacePlaceholders(array $symbols, array $replacements = array()) {
    parent::replacePlaceholders($symbols, array(self::SYMBOL_SPECIAL_PERCENT, self::SYMBOL_SPECIAL_PERMILLE));
  }
1039929
function prev(array, item) {
  if (array && array.length && item) {
    const idx = array.indexOf(item);
    return idx === -1 ? null : array[idx - 1];
  }
  return null;
}
448336
function setIteratorValues( $item, $key, $index, $number, $sequence, &$last )
    {
        $this->InternalAttributes['item'] = $item;
        $this->InternalAttributes['key'] = $key;
        $this->InternalAttributes['index'] = $index;
        $this->InternalAttributes['number'] = $number;
        $this->InternalAttributes['sequence'] = $sequence;
        $this->InternalAttributes['last'] = $last;
    }
170223
public function replace(array $items = [])
    {
        $this->items = [];

        foreach ($items as $key => $item) {
            $this->set($key, $item);
        }
    }
561256
function insert(queue, index, fns, mode = InsertMode.REGULAR) {
  fns.forEach(({ fn, name }) => {
    if (queue.findIndex(e => e.name === name) !== -1) {
      throw new Error(`${name}: A function is already queued with this name`);
    } else if (typeof fn !== 'function') {
      throw new Error(`${name}: Not a valid function`);
    }
  });

  const deleteCount = mode === InsertMode.REPLACE ? 1 : 0;
  queue.splice(index, deleteCount, ...fns);
}
1142417
function remove (arr, item) {
  if (arr.length) {
    var index = arr.indexOf(item);
    if (index > -1) {
      return arr.splice(index, 1)
    }
  }
}