Handling forks trivially; about to make them.

This commit is contained in:
C. Guy Yarvin 2016-01-11 01:16:38 -08:00
parent e529506426
commit d52ec5125f
13 changed files with 100 additions and 29 deletions

View File

@ -98,3 +98,13 @@
*/
u3_noun
u3kf_frog(u3_noun yed);
/* u3kf_grof(): build %fork span.
*/
u3_noun
u3kf_grof(u3_noun yed);
/* u3kfu_repo():
*/
u3_noun
u3kfu_repo(u3_noun, u3_noun);

View File

@ -51,6 +51,20 @@
}
}
u3_noun
u3qf_grof(u3_noun bez)
{
return u3nc(c3__frog, u3qdi_tap(bez, u3_nul));
}
u3_noun
u3kf_grof(u3_noun bez)
{
u3_noun ret = u3qf_grof(bez);
u3z(bez);
return ret;
}
u3_noun
u3wf_frog(u3_noun cor)
{

View File

@ -50,6 +50,14 @@
{
return _burn_in(van, q_sut, gil);
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun ret = _burn_in(van, fop, gil);
u3z(fop);
return ret;
}
case c3__frog: p_sut = u3t(sut);
{
return _burn_in(van, u3h(p_sut), gil);

View File

@ -150,6 +150,14 @@
u3z(foz);
return ret;
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun ret = _crop_dext(van, fop, ref, bix);
u3z(fop);
return ret;
}
case c3__frog: p_sut = u3t(sut);
{
return u3kf_frog(_crop_dext_frog(van, p_sut, ref, bix));
@ -196,12 +204,12 @@
{
return _crop_dext(van, sut, q_ref, bix);
}
case c3__fork: u3x_cell(u3t(ref), &p_ref, &q_ref);
case c3__fork: p_ref = u3t(ref);
{
u3_noun hin = _crop_dext(van, sut, p_ref, bix);
u3_noun ret = _crop_dext(van, hin, q_ref, bix);
u3_noun gif = u3qfu_repo(van, ref);
u3_noun ret = _crop_dext(van, sut, gif, bix);
u3z(hin);
u3z(gif);
return ret;
}
case c3__frog: p_ref = u3t(ref);

View File

@ -99,20 +99,13 @@
return _fish_in(van, q_sut, axe, vit);
}
}
case c3__fork: {
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
return u3m_bail(c3__fail);
}
else {
u3_noun hed = _fish_in(van, p_sut, axe, vit);
u3_noun tal = _fish_in(van, q_sut, axe, vit);
u3_noun pro = u3qf_flor(hed, tal);
case c3__fork: p_sut = u3t(sut);
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun ret = _fish_in(van, fop, axe, vit);
u3z(hed);
u3z(tal);
return pro;
}
u3z(fop);
return ret;
}
case c3__frog: {
p_sut = u3t(sut);

View File

@ -132,6 +132,14 @@
u3z(vot);
return ret;
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun ret = _fuse_in(van, fop, ref, bix);
u3z(fop);
return ret;
}
case c3__frog: p_sut = u3t(sut);
{
return u3kf_frog(_fuse_in_frog(van, p_sut, ref, bix));

View File

@ -13,10 +13,9 @@
static u3_noun
_mint_bean()
{
return u3nq(c3__frog,
u3nq(c3__atom, 'f', u3_nul, 0),
return u3kf_frog(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul);
u3_nul));
}
static u3_noun

View File

@ -24,10 +24,9 @@
static u3_noun
_mull_bean()
{
return u3nq(c3__frog,
u3nq(c3__atom, 'f', u3_nul, 0),
return u3kf_frog(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul);
u3_nul));
}
static u3_noun

View File

@ -253,6 +253,14 @@
return _nest_dext(van, q_sut, tel, ref, seg, reg, gil);
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun ret = _nest_dext(van, fop, tel, ref, seg, reg, gil);
u3z(fop);
return ret;
}
case c3__frog: p_sut = u3t(sut);
{
if ( c3n == u3du(ref) ) switch ( ref ) {
@ -404,6 +412,14 @@
return _nest_dext(van, sut, tel, q_ref, seg, reg, gil);
}
}
case c3__fork: p_ref = u3t(ref);
{
u3_noun gif = u3qfu_repo(van, ref);
u3_noun ret = _nest_sint(van, sut, tel, gif, seg, reg, gil);
u3z(gif);
return ret;
}
case c3__frog: {
p_ref = u3t(ref);

View File

@ -112,6 +112,14 @@
return _peek_in(van, q_sut, way, axe, gil);
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun ret = _peek_in(van, fop, way, axe, gil);
u3z(fop);
return ret;
}
case c3__frog: {
p_sut = u3t(sut);

View File

@ -15,10 +15,9 @@
static u3_noun
_play_bean()
{
return u3nq(c3__frog,
u3nq(c3__atom, 'f', u3_nul, 0),
return u3kf_frog(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul);
u3_nul));
}
static u3_noun

View File

@ -40,6 +40,7 @@
return u3k(q_sut);
}
}
case c3__fork: return u3qf_grof(u3t(sut));
case c3__hold: {
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
return u3m_bail(c3__fail);

View File

@ -48,6 +48,14 @@
u3k(rq_sut)));
}
}
case c3__fork: p_sut = u3t(sut);
{
u3_noun fop = u3qfu_repo(van, sut);
u3_noun ret = _cqfu_wrap(van, fop, yoz);
u3z(fop);
return ret;
}
case c3__frog: p_sut = u3t(sut);
{
return u3kf_frog(_wrap_frog(van, p_sut, yoz));