From 66a56c9293c5f1536c7228e0a6c388ce3740bed0 Mon Sep 17 00:00:00 2001 From: ~hatteb-mitlyd Date: Sun, 18 May 2014 16:16:01 -0700 Subject: [PATCH] jet mule. --- Makefile | 1 + gen164/5/mule.c | 33 +++++++++++++++++++++++++++++++++ gen164/watt.c | 2 ++ urb/zod/arvo/hoon.hoon | 2 ++ 4 files changed, 38 insertions(+) create mode 100644 gen164/5/mule.c diff --git a/Makefile b/Makefile index 0313f9f73..e5e765dfd 100644 --- a/Makefile +++ b/Makefile @@ -170,6 +170,7 @@ J164_5_OFILES=\ gen164/5/jam.o \ gen164/5/mat.o \ gen164/5/mink.o \ + gen164/5/mule.o \ gen164/5/parse.o \ gen164/5/repg.o \ gen164/5/rexp.o \ diff --git a/gen164/5/mule.c b/gen164/5/mule.c new file mode 100644 index 000000000..4eb8abdf8 --- /dev/null +++ b/gen164/5/mule.c @@ -0,0 +1,33 @@ +/* j/5/mink.c +** +** This file is in the public domain. +*/ +#include "all.h" +#include "../pit.h" + + u2_weak // produce + j2_mb(Pt5, mule)(u2_wire wir_r, + u2_noun cor) // retain + { + u2_noun tap; + + if ( u2_no == u2_mean(cor, u2_cv_sam, &tap, 0) ) { + return u2_bl_bail(wir_r, c3__exit); + } + else { + u2_noun hok = u2_bn_hook(wir_r, cor, "mute"); + /* this takes advantage of the fact that mute's result, at the typeless + * C/Nock level, is identical to what a typed mule would produce, + * without running the formula twice. + */ + return u2_bn_mong(wir_r, hok, u2k(tap));; + } + } + +/* structures +*/ + u2_ho_jet + j2_mbj(Pt5, mule)[] = { + { ".2", c3__lite, j2_mb(Pt5, mule), Tier5, u2_none, u2_none }, + { } + }; diff --git a/gen164/watt.c b/gen164/watt.c index 1eb80be53..8a362f26a 100644 --- a/gen164/watt.c +++ b/gen164/watt.c @@ -81,6 +81,7 @@ extern u2_ho_jet j2_mbj(Pt5, cue)[]; extern u2_ho_jet j2_mbj(Pt5, mat)[]; extern u2_ho_jet j2_mbj(Pt5, mink)[]; + extern u2_ho_jet j2_mbj(Pt5, mule)[]; extern u2_ho_jet j2_mbj(Pt5, jam)[]; extern u2_ho_jet j2_mbj(Pt5, loss)[]; extern u2_ho_jet j2_mbj(Pt5, lore)[]; @@ -231,6 +232,7 @@ { j2_sb(Pt5, mask), 0, j2_mbd(Pt5, mask), 0, u2_none }, { j2_sb(Pt5, mat), j2_mbj(Pt5, mat), 0, 0, u2_none }, { j2_sb(Pt5, mink), j2_mbj(Pt5, mink), 0, 0, u2_none }, + { j2_sb(Pt5, mule), j2_mbj(Pt5, mule), 0, 0, u2_none }, { j2_sb(Pt5, og), 0, j2_mbd(Pt5, og), 0, u2_none }, { j2_sb(Pt5, pfix), j2_mbj(Pt5, pfix), 0, 0, u2_none }, { j2_sb(Pt5, plug), j2_mbj(Pt5, plug), 0, 0, u2_none }, diff --git a/urb/zod/arvo/hoon.hoon b/urb/zod/arvo/hoon.hoon index 67b64540f..483b5fda1 100644 --- a/urb/zod/arvo/hoon.hoon +++ b/urb/zod/arvo/hoon.hoon @@ -428,6 +428,7 @@ %al al %ap ap %ut ut + %mute mute %seed seed %show show == @@ -3727,6 +3728,7 @@ (mink [[-.gat [sam +>.gat]] -.gat] sky) :: ++ mule :: typed virtual + ~/ %mule |* taq=_|.(_*) =+ mud=(mute taq) ?- -.mud