From 0838818881440b047faedb326ca01bae05bb03e7 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Tue, 2 Feb 2016 17:50:34 -0800 Subject: [PATCH] %face to %fuss. Next change back. --- include/jets/q.h | 1 + include/jets/w.h | 1 + jets/f/face.c | 33 ++++++++- jets/f/type.c | 3 + jets/f/ut_burn.c | 1 + jets/f/ut_crop.c | 9 +++ jets/f/ut_find.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++ jets/f/ut_fish.c | 1 + jets/f/ut_fuse.c | 8 +++ jets/f/ut_nest.c | 2 + jets/f/ut_peek.c | 1 + jets/f/ut_repo.c | 1 + jets/tree.c | 4 +- 13 files changed, 244 insertions(+), 4 deletions(-) diff --git a/include/jets/q.h b/include/jets/q.h index 96b954fd0..0a8a6c664 100644 --- a/include/jets/q.h +++ b/include/jets/q.h @@ -165,6 +165,7 @@ u3_noun u3qf_core(u3_noun, u3_noun); u3_noun u3qf_cube(u3_noun, u3_noun); u3_noun u3qf_face(u3_noun, u3_noun); + u3_noun u3qf_fuss(u3_noun, u3_noun); u3_noun u3qf_fine(u3_noun, u3_noun, u3_noun); u3_noun u3qf_fitz(u3_noun, u3_noun); u3_noun u3qf_flan(u3_noun, u3_noun); diff --git a/include/jets/w.h b/include/jets/w.h index 0fab2fa72..9754cd98d 100644 --- a/include/jets/w.h +++ b/include/jets/w.h @@ -195,6 +195,7 @@ u3_noun u3wf_core(u3_noun); u3_noun u3wf_cube(u3_noun); u3_noun u3wf_face(u3_noun); + u3_noun u3wf_fuss(u3_noun); u3_noun u3wf_fine(u3_noun); u3_noun u3wf_fitz(u3_noun); u3_noun u3wf_flan(u3_noun); diff --git a/jets/f/face.c b/jets/f/face.c index abec7b8f7..16ea87691 100644 --- a/jets/f/face.c +++ b/jets/f/face.c @@ -1,4 +1,4 @@ -/* j/6/face.c +/* j/6/fuss.c ** */ #include "all.h" @@ -13,9 +13,13 @@ if ( c3__void == tip ) { return c3__void; } - else return u3nt(c3__face, + else if ( c3y == u3du(sag) ) { + return u3m_bail(c3__fail); + } else { + return u3nt(c3__fuss, u3k(sag), u3k(tip)); + } } u3_noun u3wf_face(u3_noun cor) @@ -28,3 +32,28 @@ return u3qf_face(sag, tip); } } + +/* functions +*/ + u3_noun + u3qf_fuss(u3_noun sag, + u3_noun tip) + { + if ( c3__void == tip ) { + return c3__void; + } + else return u3nt(c3__fuss, + u3k(sag), + u3k(tip)); + } + u3_noun + u3wf_fuss(u3_noun cor) + { + u3_noun sag, tip; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_fuss(sag, tip); + } + } diff --git a/jets/f/type.c b/jets/f/type.c index d8eaa518e..14fb6df75 100644 --- a/jets/f/type.c +++ b/jets/f/type.c @@ -32,6 +32,9 @@ case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut); { } + case c3__fuss: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + } case c3__fork: p_sut = u3t(sut); { } diff --git a/jets/f/ut_burn.c b/jets/f/ut_burn.c index 2af7d4b48..5e07a797a 100644 --- a/jets/f/ut_burn.c +++ b/jets/f/ut_burn.c @@ -113,6 +113,7 @@ return ret; } } + case c3__fuss: case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut); { return _burn_in(van, q_sut, gil); diff --git a/jets/f/ut_crop.c b/jets/f/ut_crop.c index 8aaa65089..481839af2 100644 --- a/jets/f/ut_crop.c +++ b/jets/f/ut_crop.c @@ -150,6 +150,14 @@ u3z(foz); return ret; } + case c3__fuss: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + u3_noun foz = _crop_dext(van, q_sut, ref, bix); + u3_noun ret = u3qf_fuss(p_sut, foz); + + u3z(foz); + return ret; + } case c3__fork: p_sut = u3t(sut); { u3_noun yed = u3qdi_tap(p_sut, u3_nul); @@ -196,6 +204,7 @@ default: return u3m_bail(c3__fail); case c3__core: + case c3__fuss: case c3__face: u3x_cell(u3t(ref), &p_ref, &q_ref); { return _crop_dext(van, sut, q_ref, bix); diff --git a/jets/f/ut_find.c b/jets/f/ut_find.c index fd3ff1618..c7392ded3 100644 --- a/jets/f/ut_find.c +++ b/jets/f/ut_find.c @@ -27,6 +27,23 @@ 0)); } + static u3_noun + u3qfu_fund(u3_noun van, + u3_noun sut, + u3_noun way, + u3_noun gen) + { + u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0); + u3_noun gat = u3j_hook(von, "fund"); + + return u3n_kick_on(u3i_molt(gat, + u3x_sam_2, + u3k(way), + u3x_sam_3, + u3k(gen), + 0)); + } + static u3_noun u3qfu_fine(u3_noun van, u3_noun sut, @@ -399,6 +416,78 @@ return ret; } + static u3_noun + _find_buck_fuss_next(u3_noun van, + u3_noun sut, + u3_noun q_sut, + u3_noun qp_sut, + u3_noun way, + u3_noun p_heg, + u3_noun q_heg, + u3_noun axe, + u3_noun lon, + u3_noun gil) + { + if ( u3_nul == qp_sut ) { + u3_noun nol = u3nc(u3_nul, u3k(lon)); + u3_noun ret = _find_buck(van, q_sut, way, p_heg, q_heg, axe, nol, gil); + u3z(nol); + return ret; + } + else { + u3_noun iqp_sut = u3h(qp_sut); // twig + u3_noun tiv = u3qfu_mint // (pair span nock) + (van, sut, c3__noun, iqp_sut); + u3_noun tqp_sut = u3t(qp_sut); // (list (pair span nock)) + u3_noun p_tiv = u3h(tiv); // span + u3_noun q_tiv = u3t(tiv); // nock + u3_noun fid = _find_buck // pony + (van, p_tiv, way, p_heg, q_heg, 1, u3_nul, u3_nul); + + if ( u3_nul == fid ) { + u3z(tiv); + return u3_nul; + } + else if ( (c3n == u3h(fid)) && (c3y == u3h(u3t(fid))) ) { + u3_noun ret; + + ret = _find_buck_fuss_next + (van, sut, q_sut, tqp_sut, way, p_heg, q_heg, u3t(u3t(fid)), lon, gil); + u3z(fid); + u3z(tiv); + return ret; + } + else { + u3_noun tor; // port + u3_noun vat; // (pair span nock) + u3_noun ret; + u3_noun dog = u3nc(0, u3k(axe)); // nock + + if ( c3y == u3h(fid) ) { + tor = u3k(fid); + } else { + tor = u3nc(c3n, u3k(u3t(u3t(fid)))); + } + u3z(fid); + + vat = u3qfu_fine(van, q_sut, tor); + u3z(tor); + + ret = u3nq + (c3n, + c3n, + u3k(u3h(vat)), + u3qf_comb(u3t(vat), u3qf_comb(dog, q_tiv))); + + u3z(vat); + u3z(dog); + u3z(tiv); + + return ret; + } + } + } + static u3_noun _find_buck_face_next(u3_noun van, u3_noun q_sut, @@ -465,6 +554,95 @@ } } + static u3_noun + _find_buck_fuss(u3_noun van, + u3_noun sut, + u3_noun way, + u3_noun p_heg, + u3_noun q_heg, + u3_noun axe, + u3_noun lon, + u3_noun gil) + { + u3_noun p_sut, q_sut; + + u3x_cell(u3t(sut), &p_sut, &q_sut); + + if ( u3_nul == q_heg ) { + return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil); + } + else { + u3_noun uq_heg = u3t(q_heg); // term + + if ( c3y == u3ud(p_sut) ) { + if ( c3y == u3r_sing(p_sut, uq_heg) ) { + return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil); + } + else { + return _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil); + } + } + else { + u3_noun pp_sut = u3h(p_sut); // (map term (unit port)) + u3_noun qp_sut = u3t(p_sut); // (list (pair span nock)) + u3_noun tyr = u3qdb_get(pp_sut, uq_heg); // (unit (unit port)) + + if ( u3_nul == tyr ) { + return _find_buck_fuss_next + (van, sut, q_sut, qp_sut, way, p_heg, q_heg, axe, lon, gil); + } + else { + u3_noun u_tyr = u3t(tyr); // (unit port) + + if ( u3_nul == u_tyr ) { + u3_noun nol = u3nc(u3_nul, u3k(lon)); + u3_noun dep = u3qa_inc(p_heg); + u3_noun ret = _find_buck + (van, q_sut, way, dep, q_heg, axe, nol, gil); + + u3z(dep); + u3z(nol); + u3z(tyr); + return ret; + } + else { + u3_noun uu_tyr = u3t(u_tyr); + u3_noun tor = u3qfu_fund(van, sut, way, uu_tyr); + + if ( c3y == u3h(tor) ) { + u3_noun p_tor = u3t(tor); // (pair vein opal) + u3_noun pp_tor = u3h(p_tor); // vein + u3_noun qp_tor = u3t(p_tor); // opal + u3_noun nol = // vein + u3nt(u3_nul, u3nc(u3_nul, u3k(axe)), u3k(lon)); + u3_noun ret; + + ret = u3nt(c3y, u3qb_weld(pp_tor, nol), u3k(qp_tor)); + u3z(nol); + u3z(tor); + u3z(tyr); + return ret; + } + else { + u3_noun p_tor = u3t(tor); // (pair span nock) + u3_noun pp_tor = u3h(p_tor); // span + u3_noun qp_tor = u3t(p_tor); // nock + u3_noun dog = u3nc(0, u3k(axe)); // nock + u3_noun ret; + + ret = u3nq(c3n, c3n, u3k(pp_tor), u3qf_comb(dog, qp_tor)); + u3z(dog); + u3z(tor); + u3z(tyr); + + return ret; + } + } + } + } + } + } + static u3_noun _find_buck_face(u3_noun van, u3_noun sut, @@ -596,6 +774,11 @@ // fprintf(stderr, "face\r\n"); return _find_buck_face(van, sut, way, p_heg, q_heg, axe, lon, gil); } + case c3__fuss: + { + // fprintf(stderr, "face\r\n"); + return _find_buck_fuss(van, sut, way, p_heg, q_heg, axe, lon, gil); + } case c3__fork: { // fprintf(stderr, "fork\r\n"); diff --git a/jets/f/ut_fish.c b/jets/f/ut_fish.c index 7d3f1cf6a..d5a826735 100644 --- a/jets/f/ut_fish.c +++ b/jets/f/ut_fish.c @@ -92,6 +92,7 @@ case c3__core: { return u3nc(0, 0); } + case c3__fuss: case c3__face: { if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) { return u3m_bail(c3__fail); diff --git a/jets/f/ut_fuse.c b/jets/f/ut_fuse.c index 7ea073386..545add4f2 100644 --- a/jets/f/ut_fuse.c +++ b/jets/f/ut_fuse.c @@ -132,6 +132,14 @@ u3z(vot); return ret; } + case c3__fuss: u3x_cell(u3t(sut), &p_sut, &q_sut); + { + u3_noun vot = _fuse_in(van, q_sut, ref, bix); + u3_noun ret = u3qf_fuss(p_sut, vot); + + u3z(vot); + return ret; + } case c3__fork: p_sut = u3t(sut); { u3_noun yed = u3qdi_tap(p_sut, u3_nul); diff --git a/jets/f/ut_nest.c b/jets/f/ut_nest.c index 897adacae..d858390df 100644 --- a/jets/f/ut_nest.c +++ b/jets/f/ut_nest.c @@ -246,6 +246,7 @@ else return _nest_sint(van, sut, tel, ref, seg, reg, gil); } } + case c3__fuss: case c3__face: { if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) { return u3m_bail(c3__fail); @@ -409,6 +410,7 @@ u3z(gam); return hiv; } + case c3__fuss: case c3__face: { if ( c3n == u3r_trel(ref, 0, &p_ref, &q_ref) ) { return u3m_bail(c3__fail); diff --git a/jets/f/ut_peek.c b/jets/f/ut_peek.c index 41c0c5b8d..a0018153c 100644 --- a/jets/f/ut_peek.c +++ b/jets/f/ut_peek.c @@ -105,6 +105,7 @@ return pro; } } + case c3__fuss: case c3__face: { if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) { return u3m_bail(c3__fail); diff --git a/jets/f/ut_repo.c b/jets/f/ut_repo.c index 8f296c897..d5f9932ad 100644 --- a/jets/f/ut_repo.c +++ b/jets/f/ut_repo.c @@ -34,6 +34,7 @@ return u3nt(c3__cell, c3__noun, u3k(p_sut)); } } + case c3__fuss: case c3__face: { if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) { return u3m_bail(c3__fail); diff --git a/jets/tree.c b/jets/tree.c index 398d20291..7a8f3f57d 100644 --- a/jets/tree.c +++ b/jets/tree.c @@ -349,7 +349,7 @@ static u3j_harm _mood__hoon__ut_burn_a[] = {{".2", u3wfu_burn}, {}}; static u3j_harm _mood__hoon__ut_conk_a[] = {{".2", u3wfu_conk}, {}}; static u3j_harm _mood__hoon__ut_crop_a[] = {{".2", u3wfu_crop}, {}}; // static u3j_harm _mood__hoon__ut_fire_a[] = {{".2", u3wfu_fire}, {}}; -// static u3j_harm _mood__hoon__ut_fond_a[] = {{".2", u3wfu_fond}, {}}; +static u3j_harm _mood__hoon__ut_fond_a[] = {{".2", u3wfu_fond}, {}}; static u3j_harm _mood__hoon__ut_fish_a[] = {{".2", u3wfu_fish}, {}}; static u3j_harm _mood__hoon__ut_fuse_a[] = {{".2", u3wfu_fuse}, {}}; static u3j_harm _mood__hoon__ut_mint_a[] = {{".2", u3wfu_mint}, {}}; @@ -367,7 +367,7 @@ static u3j_core _mood__hoon__ut_d[] = { "burn", _mood__hoon__ut_burn_a }, { "conk", _mood__hoon__ut_conk_a }, { "crop", _mood__hoon__ut_crop_a }, -// { "fond", _mood__hoon__ut_fond_a }, + { "fond", _mood__hoon__ut_fond_a }, // { "fire", _mood__hoon__ut_fire_a }, { "fish", _mood__hoon__ut_fish_a }, { "fuse", _mood__hoon__ut_fuse_a },