Пример #1
0
  u3_noun
  _cqe_stew_fun(u3_noun hel,
                u3_noun tub)
  {
    u3_noun p_tub, q_tub;

    u3x_cell(tub, &p_tub, &q_tub);
    if ( c3n == u3du(q_tub) ) {
      return _fail(tub);
    }
    else {
      u3_noun iq_tub = u3h(q_tub);

      if ( !_(u3a_is_cat(iq_tub)) ) {
        return u3m_bail(c3__fail);
      }
      else while ( 1 ) {
        if ( c3n == u3du(hel) ) {
          return _fail(tub);
        }
        else {
          u3_noun n_hel, l_hel, r_hel;
          u3_noun pn_hel, qn_hel;
          c3_o    bit_o;

          u3x_trel(hel, &n_hel, &l_hel, &r_hel);
          u3x_cell(n_hel, &pn_hel, &qn_hel);

          if ( (c3n == u3du(pn_hel)) ) {
            bit_o = __((iq_tub == pn_hel));
          }
          else {
            u3_noun hpn_hel = u3h(pn_hel);
            u3_noun tpn_hel = u3t(pn_hel);

            if ( !_(u3a_is_cat(hpn_hel)) ||
                 !_(u3a_is_cat(tpn_hel)) ) {
              return _fail(tub);
            }
            else bit_o = __((iq_tub >= hpn_hel) && (iq_tub <= tpn_hel));
          }

          if ( c3y == bit_o ) {
            return u3x_good
              (u3n_slam_on(u3k(qn_hel), u3k(tub)));
          } else {
            if ( c3y == _stew_wor(iq_tub, pn_hel) ) {
              hel = l_hel;
            }
            else hel = r_hel;
          }
        }
      }
    }
  }
Пример #2
0
  u2_noun                                                         //  produce
  j2_mcx(Pt5, stew, fun)(u2_wire wir_r,
                         u2_noun hel,                             //  retain
                         u2_noun tub)                             //  retain
  {
    u2_noun p_tub, q_tub;

    u2_bi_cell(wir_r, tub, &p_tub, &q_tub);
    if ( u2_no == u2_dust(q_tub) ) {
      return _fail(wir_r, tub);
    }
    else {
      u2_noun iq_tub = u2_h(q_tub);

      if ( !u2_fly_is_cat(iq_tub) ) {
        return u2_bl_bail(wir_r, c3__fail);
      } else while ( 1 ) {
        if ( u2_no == u2_dust(hel) ) {
          return _fail(wir_r, tub);
        } 
        else {
          u2_noun n_hel, l_hel, r_hel;
          u2_noun pn_hel, qn_hel;
          c3_t    bit_t;

          u2_bi_trel(wir_r, hel, &n_hel, &l_hel, &r_hel);
          u2_bi_cell(wir_r, n_hel, &pn_hel, &qn_hel);

          if ( (u2_no == u2_dust(pn_hel)) ) {
            bit_t = (iq_tub == pn_hel);
          }
          else {
            u2_noun hpn_hel = u2_h(pn_hel);
            u2_noun tpn_hel = u2_t(pn_hel);

            if ( !u2_fly_is_cat(hpn_hel) || !u2_fly_is_cat(tpn_hel) ) {
              return _fail(wir_r, tub);
            }
            else bit_t = (iq_tub >= hpn_hel) && (iq_tub <= tpn_hel);
          }

          if ( bit_t ) {
            return u2_bl_good
              (wir_r, u2_nk_mong(wir_r, qn_hel, u2_rx(wir_r, tub)));
          } else {
            if ( u2_yes == _stew_wor(wir_r, iq_tub, pn_hel) ) {
              hel = l_hel;
            }
            else hel = r_hel;
          }
        }
      }
    }
  }