Add ++skid jet

This commit is contained in:
Joan Torres 2015-09-19 09:50:39 -07:00
parent 696a20505f
commit 012dabaf6a
5 changed files with 49 additions and 0 deletions

View File

@ -153,6 +153,7 @@ J_B_OFILES=\
jets/b/reap.o \
jets/b/reel.o \
jets/b/roll.o \
jets/b/skid.o \
jets/b/skim.o \
jets/b/skip.o \
jets/b/scag.o \

View File

@ -30,6 +30,7 @@
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_skid(u3_noun, u3_noun);
u3_noun u3qb_skim(u3_noun, u3_noun);
u3_noun u3qb_skip(u3_noun, u3_noun);
u3_noun u3qb_scag(u3_atom, u3_noun);

View File

@ -29,6 +29,7 @@
u3_noun u3wb_reap(u3_noun);
u3_noun u3wb_reel(u3_noun);
u3_noun u3wb_roll(u3_noun);
u3_noun u3wb_skid(u3_noun);
u3_noun u3wb_skim(u3_noun);
u3_noun u3wb_skip(u3_noun);
u3_noun u3wb_scag(u3_noun);

44
jets/b/skid.c Normal file
View File

@ -0,0 +1,44 @@
/* j/2/skid.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_skid(u3_noun a,
u3_noun b)
{
if ( 0 == a ) {
return u3nc(u3_nul, u3_nul);
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
} else {
u3_noun acc = u3qb_skid(u3t(a), b);
u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
switch ( hoz ) {
case c3y: acc = u3nc(u3nc(u3k(u3h(a)), u3h(acc)), u3t(acc));
break;
case c3n: acc = u3nc(u3h(acc), u3nc(u3k(u3h(a)), u3t(acc)));
break;
default: u3z(hoz);
return u3m_bail(c3__exit);
}
u3z(hoz);
return acc;
}
}
u3_noun
u3wb_skid(u3_noun cor)
{
u3_noun a, b;
if ( c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qb_skid(a, b);
}
}

View File

@ -26,6 +26,7 @@ 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_skid_a[] = {{".2", u3wb_skid, c3y}, {}};
static u3j_harm _mood__hoon_skim_a[] = {{".2", u3wb_skim, c3y}, {}};
static u3j_harm _mood__hoon_skip_a[] = {{".2", u3wb_skip, c3y}, {}};
static u3j_harm _mood__hoon_scag_a[] = {{".2", u3wb_scag, c3y}, {}};
@ -458,6 +459,7 @@ static u3j_core _mood__hoon_d[] =
{ "reap", _mood__hoon_reap_a },
{ "reel", _mood__hoon_reel_a },
{ "roll", _mood__hoon_roll_a },
{ "skid", _mood__hoon_skid_a },
{ "skim", _mood__hoon_skim_a },
{ "skip", _mood__hoon_skip_a },
{ "scag", _mood__hoon_scag_a },