diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-01-12 07:04:03 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-01-12 07:04:03 -0800 |
commit | a4fe85e6df2e308241984294a3d35353d7cc083a (patch) | |
tree | 51550488a40d121c489021aca4aad7fecaecf71c /tests/017 | |
parent | 2e0f7c370fa5012cb54328eb0e73412cb3c59351 (diff) | |
download | txr-a4fe85e6df2e308241984294a3d35353d7cc083a.tar.gz txr-a4fe85e6df2e308241984294a3d35353d7cc083a.tar.bz2 txr-a4fe85e6df2e308241984294a3d35353d7cc083a.zip |
New macros: each-true, some-true, each-false, some-false.
* lisplib.c (arith_each_set_entries): Trigger autoload on
new symbols.
* stdilb/arith-each.tl (sys:arith-each): Generalize macro to
handle short-circuiting logical operations. The op-iv
parameter, which is a cons, is spread into two op and iv
parameter.
One new argument appears, short-circ. This specifies a code
for short-circuiting behavior: t means iteration continues
while the result is true; nil means it continues while it is
nil, and + means iteration continues while the accumulator is
nonzero. A new convention is in effect: the operator has
to be specified as a list in order to request accumulating
behavior, e.g (+) or (*). Otherwise the operator specifies a
predicate that is applied to the forms, without taking into
account the prior value.
(sum-each, sum-each*, mul-each, mul-each*): Spread the op-iv
arguments. Wrap the op argument in a list to request
accumulation. In the case of mul-each and mul-each*, specify +
for the short-circ argument, which means that iteration stops
when the accumulator becomes zerop. sum-each and sum-each*
specify : for the short-circ argument which is unrecognized,
and so ther is no short-circuiting behavior.
(each-true, some-true, each-false, some-false): New macros.
* tests/016/arith.tl: New tests.
* txr.1: Documented new macros and added note about possible
short-circuiting in mul-each and mul-each*.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'tests/017')
0 files changed, 0 insertions, 0 deletions