Ejemplo n.º 1
0
 /**
  * The method intersperses the specified object between each item in the list.
  *
  * @access public
  * @static
  * @param ILinkedList\Type $xs                              the left operand
  * @param Core\Type $y                                      the object to be interspersed
  * @return ILinkedList\Type                                 the list
  */
 public static function intersperse(ILinkedList\Type $xs, Core\Type $y) : ILinkedList\Type
 {
     return $xs->__isEmpty() || $xs->tail()->__isEmpty() ? $xs : ILinkedList\Type::cons($xs->head(), ILinkedList\Type::cons($y, ILinkedList\Module::intersperse($xs->tail(), $y)));
 }