Merge branch 'murn-jet' into test

Closes #402
This commit is contained in:
Raymond Pasco 2015-09-15 14:05:16 -04:00
commit ffaede9239
5 changed files with 51 additions and 0 deletions

View File

@ -148,6 +148,7 @@ J_B_OFILES=\
jets/b/lent.o \
jets/b/levy.o \
jets/b/lien.o \
jets/b/murn.o \
jets/b/need.o \
jets/b/reel.o \
jets/b/roll.o \

View File

@ -25,6 +25,7 @@
u3_noun u3qb_lent(u3_noun);
u3_noun u3qb_levy(u3_noun, u3_noun);
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_reel(u3_noun, u3_noun);
u3_noun u3qb_roll(u3_noun, u3_noun);

View File

@ -24,6 +24,7 @@
u3_noun u3wb_lent(u3_noun);
u3_noun u3wb_levy(u3_noun);
u3_noun u3wb_lien(u3_noun);
u3_noun u3wb_murn(u3_noun);
u3_noun u3wb_need(u3_noun);
u3_noun u3wb_reel(u3_noun);
u3_noun u3wb_roll(u3_noun);

46
jets/b/murn.c Normal file
View File

@ -0,0 +1,46 @@
/* j/2/murn.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_murn(u3_noun a, u3_noun b)
{
if ( 0 == a ) {
return a;
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun one = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun two = u3qb_murn(u3t(a), b);
u3_noun nex;
switch ( u3ud(one) ) {
case c3y: u3z(one);
return two;
case c3n: nex = u3nc(u3k(u3t(one)), two);
u3z(one);
return nex;
default: u3z(one);
u3z(two);
return u3_none;
}
}
}
u3_noun
u3wb_murn(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_murn(a, b);
}
}

View File

@ -21,6 +21,7 @@ static u3j_harm _mood__hoon_flop_a[] = {{".2", u3wb_flop, c3y}, {}};
static u3j_harm _mood__hoon_lent_a[] = {{".2", u3wb_lent, c3y}, {}};
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_reel_a[] = {{".2", u3wb_reel, c3y}, {}};
static u3j_harm _mood__hoon_roll_a[] = {{".2", u3wb_roll, c3y}, {}};
@ -451,6 +452,7 @@ static u3j_core _mood__hoon_d[] =
{ "lent", _mood__hoon_lent_a },
{ "levy", _mood__hoon_levy_a },
{ "lien", _mood__hoon_lien_a },
{ "murn", _mood__hoon_murn_a },
{ "need", _mood__hoon_need_a },
{ "reel", _mood__hoon_reel_a },
{ "roll", _mood__hoon_roll_a },