diff options
| author | polwex <polwex@sortug.com> | 2025-10-06 01:01:41 +0700 |
|---|---|---|
| committer | polwex <polwex@sortug.com> | 2025-10-06 01:01:41 +0700 |
| commit | c4b392a179048f936c062f5ffccc2bc25627e500 (patch) | |
| tree | 09be0904be8ec4d7ea52992ef7580d42ed0c28c1 /vere/pkg/noun/jets/c/swp.c | |
working
Diffstat (limited to 'vere/pkg/noun/jets/c/swp.c')
| -rw-r--r-- | vere/pkg/noun/jets/c/swp.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vere/pkg/noun/jets/c/swp.c b/vere/pkg/noun/jets/c/swp.c new file mode 100644 index 0000000..1d0a11b --- /dev/null +++ b/vere/pkg/noun/jets/c/swp.c @@ -0,0 +1,46 @@ +/// @file + +#include "jets/k.h" +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + +u3_noun +u3qc_swp(u3_atom a, + u3_atom b) +{ + c3_w len_w = u3r_met(a, b); + u3i_slab sab_u; + u3i_slab_init(&sab_u, a, len_w); + + for (c3_w i = 0; i < len_w; i++) { + u3r_chop(a, i, 1, len_w - i - 1, sab_u.buf_w, b); + } + + return u3i_slab_mint(&sab_u); +} + +u3_noun +u3wc_swp(u3_noun cor) +{ + u3_noun a, b; + u3x_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0); + + if ( (c3n == u3ud(a)) + || (c3n == u3ud(b)) ) + { + return u3m_bail(c3__exit); + } + + return u3qc_swp(a, b); + } + +u3_noun +u3kc_swp(u3_atom a, + u3_atom b) +{ + u3_noun pro = u3qc_swp(a, b); + u3z(a); u3z(b); + return pro; +} |
