Recursively reduce items by func, but only the items that do not cause test(items, accum) to return False.  Returns the reduced list (accum) and the list of remaining deferred items.
971909
def defer_reduce(func, items, test, accum=None):
    '''
    '''
    removals = []

    for k, item in enumerate(items):
        if test(item, accum):
            removals.append(k)
            if accum is None:
                accum = item
            else:
                accum = func(accum, item)
        
    deferred = indices_removed(items, removals)
    
    if deferred == items or not deferred:
        return accum, deferred

    return defer_reduce(func, deferred, test, accum)
474416
def dropwhilenot(func, iterable):
    
    iterable = iter(iterable)
    for x in iterable:
        if func(x): break
    else: return
    yield x
    for x in iterable:
        yield x
1053851
function cat() {
        return reduce(arguments, function(result, seq) {
            if (!arrayp(result))                 result = slice(result)
            if (!arrayp(seq) && sequencep(seq))  seq    = slice(seq)

            return result.concat(seq) })
    }
1134570
def de_duplicate(items):
    
    result = []
    for item in items:
        if item not in result:
            result.append(item)
    return result
60795
def reduce(self, dimensions=[], function=None, spreadfn=None, **kwargs):
        
        kwargs['_method_args'] = (dimensions, function, spreadfn)
        return self.__call__('reduce', **kwargs)
47067
public function reduce(callable $func = null, $initial = null)
    {
        if (null === $func) {
            return parent::reduce(static function ($carry, $item) {
                $carry += $item;

                return $carry;
            }, $initial ?? 0);
        }

        return parent::reduce($func, $initial);
    }
737995
def done(self):
        
        if self._done:
            return self._done

        if self._limit is None:
            self._done = False
        elif self.itemcount >= self._limit:
            self._done = True

        return self._done
801897
@Action(
            semantics = SemanticsOf.SAFE
    )
    @MemberOrder(sequence = "3")
    public List<FullCalendar2WicketToDoItem> complete() {
        final List<FullCalendar2WicketToDoItem> items = completeNoUi();
        if(items.isEmpty()) {
            container.informUser("No to-do items have yet been completed :-(");
        }
        return items;
    }
38337
def sum(self, callback=None):
        
        if callback is None:
            return sum(self.items)

        callback = self._value_retriever(callback)

        return self.reduce(lambda result, item: (result or 0) + callback(item))
1053758
function removeItemsFromList(list, itemsToRemove) {
    var result = [];

    _.each(list, function (item) {
        var valid = true;
        for (var i = 0; i < itemsToRemove.length; i++) {

            // if the item match one of the items to remove don't includ it in the result list
            if (item.indexOf(itemsToRemove[i]) === 0) {
                valid = false;
                break;
            }
        }

        if (valid) {
            result.push(item);
        }
    });

    return result;
}
511882
def all(self, func=None):
        
        if func is None:
            func = lambda x, *args: x
        self.altmp = True

        def testEach(value, index, *args):
            if func(value, index, *args) is False:
                self.altmp = False

        self._clean.each(testEach)
        return self._wrap(self.altmp)
859010
def after_match(self, func, full_fallback=False):
        
        iterator = iter(self)
        for item in iterator:
            if func(item):
                return iterator
        if full_fallback:
            iterator = iter(self)
        return iterator
999282
function(items, iterator, done) {
    done = done || function() {};
    var results = [];
    var failure = false;
    var expected = items.length;
    var actual = 0;
    var createIntermediary = function(index) {
      return function(err, result) {
        // Return if we found a failure anywhere.
        // We can't stop execution of functions since they've already
        // been fired off; but we can prevent excessive handling of callbacks.
        if (failure != false) {
          return;
        }

        if (err != null) {
          failure = true;
          done(err, result);
          return;
        }

        actual += 1;

        if (actual == expected) {
          done(null, results);
        }
      };
    };

    for (var i = 0; i < items.length; i++) {
      var item = items[i];
      iterator(item, createIntermediary(i));
    }

    if (items.length == 0) {
      done(null, []);
    }
  }
668802
def any(self, func):
        
        return any([func(k, v) for k, v in self.items()])
707187
function() {
            return _.reduce(this.items, function(n, item) {
                if (this.applyFilter(item)) {
                    n = n + 1;
                }
                return n;
            }, 0, this);
        }
480919
function h_reduce(memo, item) {
            if ( !memo[0] || item < memo[0]) memo[0] = item;
            if ( !memo[1] || item > memo[1]) memo[1] = item;
            return memo;
        }
750982
function(items, iterator, done) {
    done = done || function() {};
    var results = [];
    var failure = false;
    var expected = items.length;
    var current = -1;

    function callback(err, result) {
      if (err) return done(err);

      results.push(result);

      if (current == expected) {
        return done(null, results);
      } else {
        next();
      }
    }

    function next() {
      current += 1;

      var item = items[current];
      iterator(item, callback);
    }

    next()
  }