urbit/j/f/ut_sift.c

34 lines
614 B
C
Raw Normal View History

2014-01-05 06:05:33 +04:00
/* j/6/sift.c
**
** This file is in the public domain.
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2014-01-05 06:05:33 +04:00
/* boilerplate
*/
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3wfu_sift(
2014-09-06 00:13:24 +04:00
u3_noun cor)
2014-01-05 06:05:33 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sut, ref, van;
2014-01-05 06:05:33 +04:00
2014-11-18 00:56:51 +03:00
if ( (c3n == u3r_mean(cor, u3x_sam, &ref,
u3x_con, &van,
2014-01-05 06:05:33 +04:00
0)) ||
2014-11-18 00:56:51 +03:00
(u3_none == (sut = u3r_at(u3x_sam, van))) )
2014-01-05 06:05:33 +04:00
{
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2014-01-05 06:05:33 +04:00
} else {
2014-11-06 22:13:57 +03:00
return u3qfu_sift(van, sut, ref);
2014-01-05 06:05:33 +04:00
}
}
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3qfu_sift(u3_noun van,
2014-09-06 00:13:24 +04:00
u3_noun sut,
u3_noun ref)
2014-01-05 06:05:33 +04:00
{
2014-09-06 00:13:24 +04:00
return u3k(ref);
2014-01-05 06:05:33 +04:00
}