function intercalate (callable $fn)
  {
    return $this->map (function ($v, &$k) use ($fn) {
      $r = $fn ($v, $k);
      if (is_iterable ($r))
        return new HeadAndTailIterator ($v, $r, $k, true);
      return $r;
    })->unfold ();
  }
function intercalate (callable $fn)
  {
    return $this->map (function ($v, &$k) use ($fn) {
      $r = $fn ($v, $k);
      if (is_iterable ($r))
        return new HeadAndTailIterator ($v, $r, $k, true);
      return $r;
    })->unfold ();
  }
function intercalate ( callable $ fn ) { return $ this -> map ( function ( $ v , & $ k ) use ( $ fn ) { $ r = $ fn ( $ v , $ k ) ; if ( is_iterable ( $ r ) ) return new HeadAndTailIterator ( $ v , $ r , $ k , true ) ; return $ r ; } ) -> unfold ( ) ; }
Appends to each item a new one computed by the specified function. This doubles the size of the iteration set.

<p>**Note:** the resulting iteration may have duplicate keys. Use {@see reindex()} to normalize them.

@param callable $fn    A callback that receives both the value and the key of the item being iterated on the
original iteration sequence and returns the new value to be intercalated.
@return Flow
Appends to each item a new one computed by the specified function . This doubles the size of the iteration set .