original_string: function recursiveUnfold (callable $fn, $keepOriginals = false)
    {
      $w = function ($v, $k, $d) use ($fn, &$w, $keepOriginals) {
        $r = $fn ($v, $k, $d);
        if (is_iterableEx ($r)) {
          $it = new UnfoldIterator (new MapIterator ($r, $w, $d + 1), UnfoldIterator::USE_ORIGINAL_KEYS);
          return $keepOriginals
            ? new HeadAndTailIterator ($v, $it, $k, true, true)
            : $it;
        }
        return $r;
      };
      $this->map ($w, 0)->unfold ();
      return $this;
    }
code: function recursiveUnfold (callable $fn, $keepOriginals = false)
    {
      $w = function ($v, $k, $d) use ($fn, &$w, $keepOriginals) {
        $r = $fn ($v, $k, $d);
        if (is_iterableEx ($r)) {
          $it = new UnfoldIterator (new MapIterator ($r, $w, $d + 1), UnfoldIterator::USE_ORIGINAL_KEYS);
          return $keepOriginals
            ? new HeadAndTailIterator ($v, $it, $k, true, true)
            : $it;
        }
        return $r;
      };
      $this->map ($w, 0)->unfold ();
      return $this;
    }
code_tokens: function recursiveUnfold ( callable $ fn , $ keepOriginals = false ) { $ w = function ( $ v , $ k , $ d ) use ( $ fn , & $ w , $ keepOriginals ) { $ r = $ fn ( $ v , $ k , $ d ) ; if ( is_iterableEx ( $ r ) ) { $ it = new UnfoldIterator ( new MapIterator ( $ r , $ w , $ d + 1 ) , UnfoldIterator :: USE_ORIGINAL_KEYS ) ; return $ keepOriginals ? new HeadAndTailIterator ( $ v , $ it , $ k , true , true ) : $ it ; } return $ r ; } ; $ this -> map ( $ w , 0 ) -> unfold ( ) ; return $ this ; }
docstring: Maps some or all iteration values to sub-iterations recursively and unfolds them into a single iteration.
  
  <p>This is an alternative way to recursively iterate nested structures. Note that values that map to iterables
  will not show up themselves on the final iteration unless `$keepOriginals` is `true` (ex: on a filesystem
  iteration, directories themselves will not be listed, only their contents, unless the mapper returns an iterable
  that also contains the directory or `$keepOriginals == true`).
  
  <p>**Note:** the resulting iteration may have duplicate keys. Use {@see reindex()} to normalize them.
  
  @param callable $fn            A callback that receives the current value, key and nesting depth, and returns
  either the value itself or an iterable to replace that value with a sub-iteration.
  To suppress the value from the final iteration, return <kbd>NOIT()</kbd> (the empty
  iterator).
  @param bool     $keepOriginals Set to TRUE to keep the original values that map to iterables.
  @return $this
docstring_tokens: Maps some or all iteration values to sub - iterations recursively and unfolds them into a single iteration .