Ejemplo n.º 1
0
 /**
  * This method evaluates whether the left operand is identical to the right operand.
  *
  * @access public
  * @static
  * @param ILinkedList\Type $xs                              the left operand
  * @param Core\Type $ys                                     the right operand
  * @return IBool\Type                                       whether the left operand is identical
  *                                                          to the right operand
  */
 public static function id(ILinkedList\Type $xs, Core\Type $ys) : IBool\Type
 {
     // ===
     if ($ys !== null && $xs->__typeOf() == $ys->typeOf()) {
         for ($as = $xs, $bs = $ys; !$as->__isEmpty() && !$bs->__isEmpty(); $as = $as->tail(), $bs = $bs->tail()) {
             $r = $as->head()->id($bs->head());
             if (!$r->unbox()) {
                 return $r;
             }
         }
         $x_length = $xs->__length();
         $y_length = $ys->__length();
         if ($x_length == $y_length) {
             return IBool\Type::true();
         }
     }
     return IBool\Type::false();
 }