diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-05-02 21:37:14 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-05-02 21:37:14 -0700 |
commit | c102c798213053d30ee9ba4ab0aefcf5d97f4634 (patch) | |
tree | 1bbbe46d4dc635dc0d8830bcb35ea931fcf1f04b /lib.c | |
parent | c22c93cc8edeab9a16edd630a352d30b77650227 (diff) | |
download | txr-c102c798213053d30ee9ba4ab0aefcf5d97f4634.tar.gz txr-c102c798213053d30ee9ba4ab0aefcf5d97f4634.tar.bz2 txr-c102c798213053d30ee9ba4ab0aefcf5d97f4634.zip |
callf, juxt: rewrite.
* lib.[ch] (do_juxt, juxtv): Functions removed.
* eval.c (do_callf): New static function.
Implements callf without consing up an
argument list with juxt which is then applied
to the function. It's all done with a loop
which builds args on the stack.
(callf): Rewritten to use do_callf. We have
to convert the function list to dynamic
args, but that is more compact than all the
consing done by the removed juxt implementation.
(juxt): New static function: implemented trivially
using callf and list_f.
(eval_init): Change registration from removed juxtv
to juxt. Going forward, I won't be using the v
suffix on functions. That should only be used when
two versions of a function exist: one which takes
vargs, and one which takes C variable arguments
or something else like a list. Example: format
is a variadic C function with a ... in its
argument list. formatv takes a varg and is the
main implementation. vformat takes a va_list.
Leading v is the standard C convention, like
vsprintf. trailing v is the TXR convention for
a function that takes vargs, but only if it is
an alternative to one which doesn't.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 10 |
1 files changed, 0 insertions, 10 deletions
@@ -9672,16 +9672,6 @@ val chandv(varg funlist) return func_f0v(args_get_list(funlist), do_chand); } -static val do_juxt(val funcs, varg args) -{ - return mapcar(pa_12_1(func_n2(apply), args_get_list(args)), funcs); -} - -val juxtv(varg funlist) -{ - return func_f0v(args_get_list(funlist), do_juxt); -} - static val do_and(val fun1_list, varg args_in) { cnum argc = args_in->argc; |