@param callable $function

@return self
510591
public function each(callable $function): self {
        foreach ($this->nodes as $index => $node) {
            $result = $function($node, $index);

            if ($result === false) {
                break;
            }
        }

        return $this;
    }
801689
public function setActiveFromCallable(callable $callable)
    {
        $this->applyToAll(function (Menu $menu) use ($callable) {
            $menu->setActiveFromCallable($callable);
        });

        $type = Reflection::firstParameterType($callable);

        $this->applyToAll(function (Activatable $item) use ($callable, $type) {
            if (! Reflection::itemMatchesType($item, $type)) {
                return;
            }

            if ($callable($item)) {
                $item->setActive();
                $item->setExactActive();
            }
        });

        return $this;
    }
46524
public function reduceRight(callable $function)
    {
        if ($this->isEmpty()) {
            return null;
        }

        list($head, $tail) = $this->reverse()->headAndTail();

        return array_reduce($tail->all(), $function, $head);
    }
977925
public function each(callable $callback)
    {
        if ($this->isCollection()) {
            foreach ($this->data as $val) {
                $callback($this->box($val));
            }
        } else {
            $callback($this->box($this->data));
        }

        return $this;
    }
139166
public static function add(callable $func) {
		self::$_lPool[] = $func;
		if (!self::$_bHook) {
			self::$_bHook = TRUE;
			Page::doDelay();
		}
	}
519520
public function map(callable $function): NodeList {
        $nodes = $this->newNodeList();

        foreach ($this->nodes as $node) {
            $result = $function($node);

            if (!is_null($result) && $result !== false) {
                $nodes[] = $result;
            }
        }

        return $nodes;
    }
258625
public function unpack(callable $func = null): self
    {
        $func = $func ?? static function (...$args) {
            yield from $args;
        };

        /** @psalm-suppress MixedArgument */
        return $this->map(static function (/* iterable */ $args = null) use ($func) {
            return $func(...$args ?? []);
        });
    }
659595
public function calls(callable ...$callbacks): self
    {
        foreach ($callbacks as $callback) {
            $this->callsWith($callback);
        }

        return $this;
    }
1130678
public function map(callable $f) : NestableResult
    {
        return new self(
            $this->outer->map($f),
            array_map($f, $this->inner)
        );
    }
750076
public function setCallback($callback)
    {
        // If the provided $value is not a closure, make it one now for easy resolution.
        if (!is_callable($callback)) {
            $callback = function () use ($callback) {
                return $callback;
            };
        }

        if ($this->protected) {
            return $this;
        }

        $this->callback = $callback;

        return $this;
    }
751931
public function each(callable $callback)
    {
        foreach ($this->items as $key => $item) {
            $result = $callback($item, $key);

            if (false === $result) {
                break;
            }

            if (!is_object($item)) {
                $this->items[$key] = $result;
            }
        }

        return $this;
    }
1165635
public function addTypePreCallFunction($type, callable $function)
    {
        if (isset($this->alias[$type])) {
            foreach ($this->alias[$type] as $target) {
                $this->addTypePreCallFunction($target, $function);
            }
            return;
        }

        $this->tPreCallFunctions[$type][] = $function;
    }
328468
public function each(callable $callback)
	{
		foreach ($this->members as $key => $member)
		{
			if ($callback($key, $member) === false) {
				break;
			}
		}
		return $this;
	}
766278
public static function forAverage(callable $num): self {
        return new self(
                function() { return [0, 0]; },
                function(&$result, $arg) use($num) { $result[0] += $num($arg); $result[1]++; },
                function($result) { return $result[0] / $result[1]; }
        );
    }
740900
public function mapWithIndex(callable $function)
    {
        $values = array_values($this->data);

        return new Seq(array_map($function, array_keys($values), $values));
    }
111967
public function map($callable)
    {
        if (!$this->isCallable($callable)) {
            throw new ArrayObjectException(ArrayObjectException::MSG_INVALID_PARAM, [
                '$callable',
                'a callable function or method'
            ]);
        }

        $this->val(array_map($callable, $this->val()));

        return $this;
    }
67583
public function invoke($callable, $arguments = []): self
    {
        // If one argument given for each iteration, create an array for it.
        if (!\is_array($arguments)) {
            $arguments = \array_fill(
                0,
                \count($this->getArray(), \COUNT_NORMAL),
                $arguments
            );
        }

        // If the callable has arguments, pass them.
        if ($arguments) {
            $array = \array_map($callable, $this->getArray(), $arguments);
        } else {
            $array = $this->map($callable);
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }