diff options
author | polwex <polwex@sortug.com> | 2025-10-05 21:56:51 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2025-10-05 21:56:51 +0700 |
commit | fcedfddf00b3f994e4f4e40332ac7fc192c63244 (patch) | |
tree | 51d38e62c7bdfcc5f9a5e9435fe820c93cfc9a3d /vere/pkg/noun/jets/d/in_rep.c |
claude is gud
Diffstat (limited to 'vere/pkg/noun/jets/d/in_rep.c')
-rw-r--r-- | vere/pkg/noun/jets/d/in_rep.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/vere/pkg/noun/jets/d/in_rep.c b/vere/pkg/noun/jets/d/in_rep.c new file mode 100644 index 0000000..fafdad5 --- /dev/null +++ b/vere/pkg/noun/jets/d/in_rep.c @@ -0,0 +1,52 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +// [a] and [out] are TRANSFERRED +// +static void +_in_rep(u3_noun a, u3j_site* sit_u, u3_noun* out) +{ + if ( u3_nul == a ) { + return; + } + else { + u3_noun n_a, l_a, r_a; + u3x_trel(a, &n_a, &l_a, &r_a); + + u3k(n_a); + u3k(l_a); + u3k(r_a); + + *out = u3j_gate_slam(sit_u, u3nc(n_a, *out)); + + _in_rep(l_a, sit_u, out); + _in_rep(r_a, sit_u, out); + + u3z(a); + } +} + +u3_noun +u3qdi_rep(u3_noun a, u3_noun b) +{ + u3_noun out = u3k(u3x_at(u3x_sam_3, b)); + u3j_site sit_u; + + u3j_gate_prep(&sit_u, u3k(b)); + _in_rep(u3k(a), &sit_u, &out); + u3j_gate_lose(&sit_u); + + return out; +} + +u3_noun +u3wdi_rep(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0); + return u3qdi_rep(a, b); +} |