1
1
mirror of https://github.com/urbit/shrub.git synced 2024-12-22 18:31:44 +03:00
shrub/tests/kjet.c

68 lines
1.2 KiB
C
Raw Normal View History

2014-09-05 23:55:16 +04:00
/* f/meme.c
**
*/
#include "f/meme.h"
2014-09-06 00:13:24 +04:00
/* u3_cka_sub(): a + b.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_cka_gth(): a + b.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_cka_mul(): a * b.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_cka_lte(): a * b.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckb_lent(): length of list `a`.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckb_flop(): reverse list `a`.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckb_weld(): concatenate lists `a` before `b`.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckc_lsh(): left shift.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckc_rsh(): right shift.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckdb_get(): map get for key `b` in map `a` with u3_none.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
u3_weak
u3_ckdb_get(u3_noun a, u3_noun b)
2014-09-05 23:55:16 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun c = u3_cqdb_get(a, b);
2014-09-05 23:55:16 +04:00
2014-09-06 00:13:24 +04:00
u3z(a); u3z(b);
if ( u3_no == u3_cr_du(c) ) {
u3z(c);
return u3_none;
2014-09-05 23:55:16 +04:00
} else {
2014-09-06 00:13:24 +04:00
u3_noun pro = u3k(u3t(c));
2014-09-05 23:55:16 +04:00
2014-09-06 00:13:24 +04:00
u3z(c);
2014-09-05 23:55:16 +04:00
return pro;
}
}
2014-09-06 00:13:24 +04:00
/* u3_ckdb_got(): map get for key `b` in map `a` with fail.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckdb_put(): map put for key `b`, value `c` in map `a`.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckdb_gas(): list to map.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckdi_gas(): list to map.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckdb_has(): test for presence.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckdi_has(): test for presence.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_ckdi_tap(): map/set convert to list. (solves by_tap also.)
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_cke_cue(): expand saved pill.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_cke_jam(): pack noun as atom.
2014-09-05 23:55:16 +04:00
*/
2014-09-06 00:13:24 +04:00
/* u3_cke_trip(): atom to tape.
2014-09-05 23:55:16 +04:00
*/