diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-06-02 19:02:09 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-06-02 19:02:09 -0700 |
commit | 91c85dc6a85bef1c62743bd278ebeb8914bf8b4b (patch) | |
tree | 94ca0f512f5303dfd4c93b4c8be3c1a051d4d3f1 /lib.c | |
parent | dcd0c4e0485ad5f8cf571bffa99add57c8aed183 (diff) | |
download | txr-91c85dc6a85bef1c62743bd278ebeb8914bf8b4b.tar.gz txr-91c85dc6a85bef1c62743bd278ebeb8914bf8b4b.tar.bz2 txr-91c85dc6a85bef1c62743bd278ebeb8914bf8b4b.zip |
Convert each-family operators to use iter-begin.
With this change we can do (each ((x vec)) ...) with
reasonable efficiency, because we are no longer marching
through the vector with cdr, copying the suffix.
* eval.c (get_iter_f): New global variable.
(op_each): Obtain iterators for all the objects with
iter_begin, instead of treating them as lists. Probe the
iterators for termination with iter_more, get the items with
iter_item instead of car and step with iter_step instead of
cdr.
(eval_init): gc-protect the get_iter_f function and initialize
it.
* share/txr/stdlib/compiler.tl (expand-each): Replace the
car/cdr and null testing with iter-init, iter-more, iter-item
and iter-step.
Diffstat (limited to 'lib.c')
0 files changed, 0 insertions, 0 deletions