urbit/j/c/met.c
2014-11-06 11:49:41 -08:00

45 lines
755 B
C

/* j/3/met.c
**
** This file is in the public domain.
*/
#include "all.h"
/* functions
*/
u3_noun
u3qc_met(
u3_atom a,
u3_atom b)
{
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
if ( 0 == b ) {
return 0;
} else return 1;
}
else {
c3_w met_w = u3r_met(a, b);
if ( !_(u3a_is_cat(met_w)) ) {
return u3i_words(1, &met_w);
}
else return u3r_met(a, b);
}
}
u3_noun
u3wc_met(
u3_noun cor)
{
u3_noun a, b;
if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) ||
(c3n == u3ud(b)) )
{
return u3m_bail(c3__exit);
} else {
return u3qc_met(a, b);
}
}