public function select(callable $inSelector, $inOptLimit=0) {

        $result = [ 'found' => [], 'count' => 0, 'continue' => true ];
        $find = function(Node $inNode, array &$inOutResult) use ($inOptLimit, $inSelector) {
            if (! $inOutResult['continue']) {
                return;
            }

            if ($inSelector($inNode->getData())) {
                $inOutResult['found'][] = $inNode;
                $inOutResult['count'] += 1;
                if ($inOptLimit > 0) {
                    if ($inOutResult['count'] >= $inOptLimit) {
                        $inOutResult['continue'] = false;
                    }
                }
            }
        };

        $this->traverse($find, $result);
        return $result['found'];
    }