diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-03-01 20:41:54 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-03-01 20:41:54 -0800 |
commit | 1134089866fde0478fe869aa6fa13e105325ddcd (patch) | |
tree | 714467630869f07c53403f84e1e791c5d229eb59 /lib.c | |
parent | d102e01cc47fedbb008ea5ea3757ad4415e1e4eb (diff) | |
download | txr-1134089866fde0478fe869aa6fa13e105325ddcd.tar.gz txr-1134089866fde0478fe869aa6fa13e105325ddcd.tar.bz2 txr-1134089866fde0478fe869aa6fa13e105325ddcd.zip |
zip: make more generic.
* lib.c (do_pa_12_1_v, pa_12_1_v): Static functions removed.
(transposev, transpose): Functions removed.
* lib.c (transposev, transpose): Declarations removed.
* eval.c (join_f): New global variable.
(zip_fun, zipv, transpose): New static functions.
(eval_init): gc-protect join_f, and initialize it.
Registration of zip intrinsic goes to zipv rather
than transposev. sys:fmt-join and join registered
with help of global join_f rather than local.
* tests/012/seq.tl: New zip test cases.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 39 |
1 files changed, 0 insertions, 39 deletions
@@ -9227,16 +9227,6 @@ val pa_12_1(val fun2, val arg2) return func_f1(cons(fun2, arg2), do_pa_12_1); } -static val do_pa_12_1_v(val fcons, varg args) -{ - return funcall2(car(fcons), args_get_list(args), cdr(fcons)); -} - -static val pa_12_1_v(val fun2, val arg2) -{ - return func_f0v(cons(fun2, arg2), do_pa_12_1_v); -} - static val do_pa_123_3(val fcons, val arg3) { return funcall3(car(fcons), car(cdr(fcons)), cdr(cdr(fcons)), arg3); @@ -9292,35 +9282,6 @@ val pa_1234_34(val fun4, val arg1, val arg2) return func_f2(cons(fun4, cons(arg1, arg2)), do_pa_1234_34); } -val transposev(varg list) -{ - val func = list_f; - - if (!args_more(list, 0)) - return nil; - - switch (type(args_at(list, 0))) { - case STR: - case LSTR: - case LIT: - func = pa_12_1_v(func_n2(cat_str), nil); - break; - case VEC: - func = func_n0v(vectorv); - break; - default: - break; - } - - return mapcarv(func, list); -} - -val transpose(val seq) -{ - args_decl_list(args, ARGS_MIN, tolist(seq)); - return make_like(transposev(args), seq); -} - static val do_chain(val fun1_list, varg args) { val arg = nil; |