up

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

lu_del.c (639B)


      1 #include "all.h"
      2 
      3 u3_noun
      4 u3qdl_del(u3_noun a, u3_noun k)
      5 {
      6   u3_noun cap_a, siz_a, tic_a, pri_a;
      7   u3x_qual(a, &cap_a, &siz_a, &tic_a, &pri_a);
      8 
      9   u3_noun ded = u3qdu_dew(pri_a, k);
     10 
     11   if (u3_nul == ded) {
     12     return u3k(a);
     13   }
     14   else {
     15     u3_noun pd, qd, rd;
     16     u3x_trel(u3t(ded), &pd, &qd, &rd);
     17 
     18     u3_noun pro = u3nq(u3k(cap_a), u3qa_dec(siz_a), u3k(tic_a), u3k(rd));
     19 
     20     u3z(ded);
     21 
     22     return pro;
     23   }
     24 }
     25 
     26 u3_noun
     27 u3wdl_del(u3_noun cor)
     28 {
     29   u3_noun a, k;
     30 
     31   if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &k, 0)) ||
     32        (c3n == u3du(a)) )
     33   {
     34     return u3m_bail(c3__exit);
     35   } else {
     36     return u3qdl_del(a, k);
     37   }
     38 }
     39