Commit graph

12 commits

Author SHA1 Message Date
Ekaitz Zarraga
967b888d8c Reduce iterations in concatenate!
This commit should reduce the amount of iterations in concatenate to N
where N is the sum of the lengths of the input lists.

The previous implementation iterated from the beginning in each
concatenation because of `last-pair`.

This implementation is significantly faster in this extreme case:

(concatenate! `(,(iota 50000) ,@(map list (iota 500))))

>> Previous implementation:
real	0m0.671s
user	0m0.658s
sys	0m0.013s

>> This implementation:
real	0m0.175s
user	0m0.174s
sys	0m0.001s

The tests is done using `time`, which is not reliable at all, but using
`(trace last-pair)` shows accurately what happens with the iterations.
2024-01-09 17:18:41 +01:00
Ekaitz Zarraga
70989e0cef srfi: 1: add tests for append! (and concatenate!) 2024-01-09 01:04:34 +01:00
Ekaitz Zarraga
7bf376b7fb Fix: concatenate! work with empty lists 2024-01-08 22:56:07 +01:00
Alex Shinn
255ee079e5 fix order of arguments in lset= 2020-05-27 14:27:31 +09:00
Alex Shinn
521e23e3c7 Reduce error in sexp_read_float_tail (from Taylor R Campbell)
scale*10 is computed exactly until scale exceeds 2^54/10; in
contrast, scale*0.1 may not be computed exactly, and fl(0.1) is not
even 0.1.

WARNING: This change is not complete -- it does nothing to prevent
overflow with very long strings of digits after the decimal point.
2018-12-02 12:22:14 +08:00
Alex Shinn
22af18dd18 adding (srfi 116) 2017-08-24 21:29:33 +09:00
Alex Shinn
32bd7fbad6 fixing corner cases in pair-fold, alist-delete and reduce-right 2017-08-24 21:27:08 +09:00
Alex Shinn
779c60ac35 add check for empty second list in list= (fixes issue #407) 2017-05-08 12:04:13 +09:00
Alex Shinn
35279b45c3 adding tests for first..tenth 2015-06-08 23:59:55 +09:00
Frère Jérôme
453c0f1a1d Correction to the 8-10th selector aliases 2015-06-06 17:19:45 +02:00
Alex Shinn
4e5cdedc03 Converting tests to modules instead of separate programs.
By convention, a library meant for testing exports "run-tests".
Also by convention, assume the test for (foo bar) is (foo bar-test),
keeping the test in the same directory and avoiding confusion since
(chibi test) is not a test for (chibi).
- Avoids the hack of "load"ing test, with resulting namespace complications.
- Allows keeping tests together with the libraries.
- Allows setting up test hooks before running.
- Allows implicit inference of test locations when using above conventions.
2015-04-05 23:38:51 +09:00
Alex Shinn
2922ed591d Forgot to install regexp (patch from Lorenzo) 2015-01-26 08:06:59 +09:00