summaryrefslogtreecommitdiffstats
path: root/tests/012/iter.tl
Commit message (Collapse)AuthorAgeFilesLines
* New: callable integers and ranges.Kaz Kylheku2023-06-281-2/+2
| | | | | | | | | | | | | | | | | * lib.c (do_generic_funcall): Allow integers and ranges to be function callable. They take one argument and index into it or extract a slice. In the case of ranges, this is a breaking change. Ranges can already be used in the function position in some limited ways that are not worth preserving. * tests/012/callable.tl: New file. * tests/012/iter.tl: Here we fix two instances of breakage. Using txr -C 288 will restore the behaviors previously tested here. * txr.1: Documented.
* seq-iter: bugfix: floating-point ranges.Kaz Kylheku2022-09-151-0/+23
| | | | | | | | | | | | | | | | | | | | | | * lib.c (seq_iter_get_range_bignum): Static function renamed to seq_iter_get_range_number because it in fact generalizes to numbers. (seq_iter_peek_range_bignum): Renamed to seq_iter_peek_range_number. (seq_iter_get_rev_range_bignum): Renamed to seq_iter_get_rev_range_number. (seq_iter_peek_rev_range_bignum): Renamed to seq_iter_peek_rev_range_number. (si_range_bignum_ops): Renamed to si_range_number_ops. (si_rev_range_bignum_ops): Renamed to si_rev_range_number_ops. (seq_iter_init_with_info): Handle ranges where the from value is floating-point. Also, if the from-value is bignum that fits into cnum range, we now try to handle that as a cnum range. * tests/012/iter.tl: New tests.
* seq_iter: some new test cases.Kaz Kylheku2021-08-301-0/+8
| | | | | * tests/012/iter.tl: Several new cases to provide some coverage in recently fixed areas. All of these break in 268.
* sub: allow generic iterables.Kaz Kylheku2021-08-221-0/+19
| | | | | | | | | | | | | | | | In this patch we allow the s in (sub s from to) and [s from..to] to be any iterable. * lib.c (iter_dynamic, sub_iter): New static function. (generic_funcall): Handle all objects via the sequence case: ref, sub and all that. Unfortunately, we lose some error handling at the level of the sub function. But we allow any iterable to be passed through to sub. (sub): Handle default case through sub_iter. * tests/012/iter.tl: New cases. * txr.1: Documented.
* iter-begin: string range support.Kaz Kylheku2021-08-221-0/+42
Ranges like "AAA".."ZZZ" are now possible. * lib.c (seq_iter_get_range_str, seq_iter_peek_range_str, seq_iter_get_rev_range_str): New static functions. (seq_iter_init_with_info): Support string ranges via above new functions. Range direction test is now done with less and equal rather than lt and gt. * tests/012/iter.tl: New file. * txr.1: Documented.