Add ++reap jet

This commit is contained in:
Joan Torres 2015-09-16 13:29:39 -07:00
parent ffaede9239
commit dfc529f274
5 changed files with 46 additions and 0 deletions

View File

@ -150,6 +150,7 @@ J_B_OFILES=\
jets/b/lien.o \
jets/b/murn.o \
jets/b/need.o \
jets/b/reap.o \
jets/b/reel.o \
jets/b/roll.o \
jets/b/skim.o \

View File

@ -27,6 +27,7 @@
u3_noun u3qb_lien(u3_noun, u3_noun);
u3_noun u3qb_murn(u3_noun, u3_noun);
u3_noun u3qb_need(u3_noun);
u3_noun u3qb_reap(u3_atom, u3_noun);
u3_noun u3qb_reel(u3_noun, u3_noun);
u3_noun u3qb_roll(u3_noun, u3_noun);
u3_noun u3qb_skim(u3_noun, u3_noun);

View File

@ -26,6 +26,7 @@
u3_noun u3wb_lien(u3_noun);
u3_noun u3wb_murn(u3_noun);
u3_noun u3wb_need(u3_noun);
u3_noun u3wb_reap(u3_noun);
u3_noun u3wb_reel(u3_noun);
u3_noun u3wb_roll(u3_noun);
u3_noun u3wb_skim(u3_noun);

41
jets/b/reap.c Normal file
View File

@ -0,0 +1,41 @@
/* j/2/reap.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_reap(u3_atom a,
u3_noun b)
{
if ( !_(u3a_is_cat(a)) ) {
return u3m_bail(c3__fail);
}
else {
u3_noun acc = u3_nul;
c3_w i_w = a;
while ( i_w ) {
acc = u3nc(b, acc);
i_w--;
}
return acc;
}
}
u3_noun
u3wb_reap(u3_noun cor)
{
u3_noun a, b;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ||
(c3n == u3ud(a)) )
{
return u3m_bail(c3__exit);
} else {
return u3qb_reap(a, b);
}
}

View File

@ -23,6 +23,7 @@ static u3j_harm _mood__hoon_levy_a[] = {{".2", u3wb_levy, c3y}, {}};
static u3j_harm _mood__hoon_lien_a[] = {{".2", u3wb_lien, c3y}, {}};
static u3j_harm _mood__hoon_murn_a[] = {{".2", u3wb_murn, c3y}, {}};
static u3j_harm _mood__hoon_need_a[] = {{".2", u3wb_need, c3y}, {}};
static u3j_harm _mood__hoon_reap_a[] = {{".2", u3wb_reap, c3y}, {}};
static u3j_harm _mood__hoon_reel_a[] = {{".2", u3wb_reel, c3y}, {}};
static u3j_harm _mood__hoon_roll_a[] = {{".2", u3wb_roll, c3y}, {}};
static u3j_harm _mood__hoon_skim_a[] = {{".2", u3wb_skim, c3y}, {}};
@ -454,6 +455,7 @@ static u3j_core _mood__hoon_d[] =
{ "lien", _mood__hoon_lien_a },
{ "murn", _mood__hoon_murn_a },
{ "need", _mood__hoon_need_a },
{ "reap", _mood__hoon_reap_a },
{ "reel", _mood__hoon_reel_a },
{ "roll", _mood__hoon_roll_a },
{ "skim", _mood__hoon_skim_a },