Artifacts Associated With Ticket 999b6966b29915bf
Ticket change [0fdc01f2df] (rid 248868) by juliannoble2 on 2025-11-27 16:34:31:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
Documentation states: If a step vale is included, it's sign should agree with the direction of the sequence (descending → negative and ascending → positive), otherwise an empty list is returned The behaviour of lseq only matches this statement for step sizes up to the length of the sequence. %lseq 1 to 10 by -9 %lseq 1 to 10 by -10 1 %lseq 10 to 1 by 9 %lseq 10 to 1 by 10 10
- is_private initialized to: "0"
- login: "juliannoble2"
- priority initialized to: "5 Medium"
- private_contact initialized to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "juliannoble2"
- subsystem initialized to: "17. Commands I-L"
- title initialized to:
lseq doc mismatch for sign not agreeing with seq direction
- type initialized to: "Bug"
Ticket change [d3a4eb2a8a] (rid 248869) by juliannoble2 on 2025-11-27 17:01:50:
- icomment:
There is also consistency with a directionless sequence to be considered %lseq 10 10 $x returns 10 for any value of $x except zero - which seems reasonable. My feeling is that lseq should return the first element even when the sign doesn't match as that (to me anyway) seems the most logically consistent. As it stands, with the possibility to use basic integer expressions for start and and step - the behaviour feels surprising, even though these are somewhat edge cases.
- login: "juliannoble2"
- mimetype: "text/plain"
- icomment:
Ticket change [a695eaaa28] (rid 248881) by oehhar on 2025-11-28 09:32:42:
- icomment:
Changed the ticket title to also describe the bug, that the start element is not returned on some step values. It might be better, if the start element is always returned. A step value of 0 leads theoretically to an endles sequence. It might lead to an error or return the empty list in all cases. And documentation can always be improved... Thanks, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- title changed to:
lseq should return start element independent of step, doc mismatch for sign not agreeing with seq direction
- username: "oehhar"
- icomment:
Ticket change [ab336a50b0] (rid 250324) by cdubois on 2026-01-12 03:32:17:
- icomment:
+1 on Harald's suggestion. It seems more consistent if `lseq` always returns the start element, independent of the step sign, and only the generation of subsequent elements is affected by direction/sign. If that is the intended behavior, I can draft a small regression-test patch covering the reported cases (sign mismatch with large `by`, and the `start==end` “directionless” case). We may also want to decide and document what should happen for `by 0` (error vs empty list).
- login: "cdubois"
- mimetype: "text/plain"
- icomment:
Ticket change [87e19a3199] (rid 250346) by griffin on 2026-01-12 13:00:21:
- comment changed to:
Documentation states: If a step vale is included, it's sign should agree with the direction of the sequence (descending → negative and ascending → positive), otherwise an empty list is returned The behaviour of lseq only matches this statement for step sizes up to the length of the sequence. %lseq 1 to 10 by -9 %lseq 1 to 10 by -10 1 %lseq 10 to 1 by 9 %lseq 10 to 1 by 10 10 It should return start element independent of step, doc mismatch for sign not agreeing with seq direction.
- login: "griffin"
- mimetype: "text/plain"
- title changed to: "lseq has incorrect results in edge cases"
- comment changed to:
Ticket change [1e043d1f24] (rid 250347) by griffin on 2026-01-12 13:03:03:
- assignee changed to: "griffin"
- login: "griffin"
- mimetype: "text/plain"
Ticket change [9c8161eb46] (rid 250376) by griffin on 2026-01-14 16:09:40:
- icomment:
Errors are reserved for any arguments that are invalid, e.g. a numeric argument is not a number. Otherwise, a sequence is created. A sequence is defined as a mathematic expression: Y = mX + b The list also has a size (length) limit based on the arguments (start, end, step): count = int( (end - start + 1) / step ) If the count is 0 or negative, the sequence is considered empty, and an empty set is a valid result. The sequence can be the empty set when a terminating boundary is met, and there are no prior results, or if the direction of the sequence is inconsistent. For example, the sequence from 1 to 10 by -1 will produce the empty set since the direction of the range is opposite of the increment. With that being said, there are bugs in the algorithm that need to be addressed. - login: "griffin"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [407da858a1] (rid 251377) by griffin on 2026-02-07 03:04:17:
- icomment:
Fix branch - wip: [https://core.tcl-lang.org/tcl/timeline?r=lseq_bug_fixes] resolves this bug, bug [8d1fc7099570], and TIP [https://core.tcl-lang.org/tips/doc/trunk/tip/746.md]
- login: "griffin"
- mimetype: "text/x-fossil-plain"
- icomment:
Ticket change [426207c377] (rid 251381) by oehhar on 2026-02-07 11:04:23:
- icomment:
Thanks, Brian. Empy list feels right. Sorry for my wrong contribution. Thanks for all, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"
- icomment:
Ticket change [634f4cb2fa] (rid 251969) by jan.nijtmans on 2026-03-09 07:37:59:
- closedate changed to: "2461108.8180512846"
- closer changed to: "jan.nijtmans"
- icomment:
Since the fix branch is now merged to both 9.0 and trunk, closing! Thanks, Brian (and others)!
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Closed"