You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Björn Kautler (Jira)" <ji...@apache.org> on 2020/07/22 23:11:00 UTC

[jira] [Created] (GROOVY-9649) left-open and full-open ranges

Björn Kautler created GROOVY-9649:
-------------------------------------

             Summary: left-open and full-open ranges
                 Key: GROOVY-9649
                 URL: https://issues.apache.org/jira/browse/GROOVY-9649
             Project: Groovy
          Issue Type: New Feature
            Reporter: Björn Kautler


I found there are right-open ranges like {{1..<5}} for {{[1, 2, 3, 4]}}, but no left-open ranges and full-open ranges.

I'd like to suggest adding those, e. g. {{1<..5}} for {{[2, 3, 4, 5]}} and {{1<..<5}} for {{[2, 3, 4]}}.

For decimals it would be similar, just omitting the lower bound if it matches.

Currently

{{3.5..<5.7}} gives {{[3.5, 4.5, 5.5]}}
{{3.5..<5.5}} gives {{[3.5, 4.5]}}

So with my suggestion it would then probably be
{{3.5<..5.5}} gives {{[4.5, 5.5]}}
{{3.5<..<5.7}} gives {{[4.5, 5.5]}}
{{3.5<..<5.5}} gives {{[4.5]}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)