diff --git a/Makefile b/Makefile index 58a8ec34ad..9ec9c5758d 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/include/jets/q.h b/include/jets/q.h index 78de9e2acf..22c64d725b 100644 --- a/include/jets/q.h +++ b/include/jets/q.h @@ -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); diff --git a/include/jets/w.h b/include/jets/w.h index 74b02e7410..70e54bd39b 100644 --- a/include/jets/w.h +++ b/include/jets/w.h @@ -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); diff --git a/jets/b/murn.c b/jets/b/murn.c new file mode 100644 index 0000000000..08647c4446 --- /dev/null +++ b/jets/b/murn.c @@ -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); + } + } + diff --git a/jets/tree.c b/jets/tree.c index 7b9eda6bae..f87f1acf52 100644 --- a/jets/tree.c +++ b/jets/tree.c @@ -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 },