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/f/cons.c |
claude is gud
Diffstat (limited to 'vere/pkg/noun/jets/f/cons.c')
-rw-r--r-- | vere/pkg/noun/jets/f/cons.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/vere/pkg/noun/jets/f/cons.c b/vere/pkg/noun/jets/f/cons.c new file mode 100644 index 0000000..45719c1 --- /dev/null +++ b/vere/pkg/noun/jets/f/cons.c @@ -0,0 +1,54 @@ +/// @file + +#include "jets/q.h" +#include "jets/w.h" + +#include "noun.h" + + + u3_noun + u3qf_cons(u3_noun vur, + u3_noun sed) + { + u3_noun p_vur, p_sed; + + if ( c3y == u3r_p(vur, 1, &p_vur) && + c3y == u3r_p(sed, 1, &p_sed) ) { + return u3nt(1, + u3k(p_vur), + u3k(p_sed)); + } +#if 0 + else if ( c3y == u3r_p(vur, 0, &p_vur) && + c3y == u3r_p(sed, 0, &p_sed) && + !(c3y == u3r_sing(1, p_vur)) && + !(c3y == u3r_sing(p_vur, p_sed)) && + (0 == u3r_nord(p_vur, p_sed)) ) + { + u3_atom fub = u3qa_div(p_vur, 2); + u3_atom nof = u3qa_div(p_sed, 2); + + if ( c3y == u3r_sing(fub, nof) ) { + u3z(nof); + + return u3nc(0, fub); + } + else { + u3z(fub); + u3z(nof); + } + } +#endif + return u3nc(u3k(vur), u3k(sed)); + } + u3_noun + u3wf_cons(u3_noun cor) + { + u3_noun vur, sed; + + if ( c3n == u3r_mean(cor, u3x_sam_2, &vur, u3x_sam_3, &sed, 0) ) { + return u3m_bail(c3__fail); + } else { + return u3qf_cons(vur, sed); + } + } |