urbit/jets/e/mule.c

24 lines
501 B
C
Raw Normal View History

2014-08-20 10:22:41 +04:00
/* j/5/mule.c
2014-05-19 03:16:01 +04:00
**
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3we_mule(u3_noun cor)
2014-05-19 03:16:01 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun tap;
2014-05-19 03:16:01 +04:00
2014-11-18 00:56:51 +03:00
if ( c3n == u3r_mean(cor, u3x_sam, &tap, 0) ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__exit);
2014-05-19 03:16:01 +04:00
}
else {
2014-11-06 03:20:01 +03:00
u3_noun hok = u3j_hook(u3k(cor), "mute");
2014-08-20 10:22:41 +04:00
2014-05-19 03:16:01 +04:00
/* 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.
*/
2014-11-06 03:20:01 +03:00
return u3n_slam_on(hok, u3k(tap));
2014-05-19 03:16:01 +04:00
}
}