up

A priority search queue and LRU cache.
git clone git://git.jtobin.io/up.git
Log | Files | Refs

up_qat_pour.c (588B)


      1 #include "all.h"
      2 
      3 u3_noun
      4 u3qdu_qat_pour(u3_noun a)
      5 {
      6   u3_noun bot = u3qdu_qor_bot(a);
      7 
      8   if (u3_nul == bot) {
      9     return u3_nul;
     10   }
     11   else {
     12     u3_noun u = u3t(bot);
     13 
     14     u3_noun pu, qu;
     15     u3x_cell(u, &pu, &qu);
     16 
     17     u3_atom k_pu, p_pu, v_pu;
     18     u3x_trel(pu, &k_pu, &p_pu, &v_pu);
     19 
     20     u3_noun pro = u3nc(u3_nul, u3nq(u3k(p_pu), u3k(k_pu), u3k(v_pu), u3k(qu)));
     21 
     22     u3z(bot);
     23 
     24     return pro;
     25   }
     26 }
     27 
     28 u3_noun
     29 u3wdu_qat_pour(u3_noun cor)
     30 {
     31   u3_noun a;
     32 
     33   if (c3n == u3r_mean(cor, u3x_sam, &a, 0))
     34   {
     35     return u3m_bail(c3__exit);
     36   } else {
     37     return u3qdu_qat_pour(a);
     38   }
     39 }
     40 
     41