diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-01-07 01:51:02 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-01-07 01:51:02 -0800 |
commit | ca5440c579407ba9d572e41b3bab6031c71949a3 (patch) | |
tree | 75675a614945779c8805c1dc84928961b5a8ef55 | |
parent | 6e9e8e07abfed921264c100297844dd5969d6e42 (diff) | |
download | txr-ca5440c579407ba9d572e41b3bab6031c71949a3.tar.gz txr-ca5440c579407ba9d572e41b3bab6031c71949a3.tar.bz2 txr-ca5440c579407ba9d572e41b3bab6031c71949a3.zip |
tail: reduce calls to cdr.
* lib.c (tail): Don't call cdr on the same cell twice in the
loop body. tail is used in list_collect and friends, which are
used all over the place.
-rw-r--r-- | lib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -655,8 +655,9 @@ val listref(val list, val ind) loc tail(val cons) { - while (consp(cdr(cons))) - cons = cdr(cons); + val d; + for (d = cdr(cons); consp(d); d = cdr(d)) + cons = d; return cdr_l(cons); } |