Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax improvement for count of string set #1966

Open
captainGeech42 opened this issue Sep 20, 2023 · 1 comment
Open

Syntax improvement for count of string set #1966

captainGeech42 opened this issue Sep 20, 2023 · 1 comment

Comments

@captainGeech42
Copy link
Contributor

captainGeech42 commented Sep 20, 2023

Is your feature request related to a problem? Please describe.
When trying to get a count of a set of strings, there is no obvious syntax for this. Normally, it would be represented like this:

strings:
    $s1 = "hello"
    $s2 = "world"
condition:
    (#s1 + #s2) > 5

However, when you have a large number of strings you want to get the string set count sum of, it becomes pretty unwieldy.

A partial workaround is to use this syntax: for 5 of ($s*): (#), which isn't super intuitive but does work.

Describe the solution you'd like
A more clean and obvious syntax for this would be beneficial. An obvious candidate is (#s*) > 5. This would also enable more expressive boolean logic on the count, rather than just >=.

Describe alternatives you've considered
n/a

Additional context
n/a

@plusvic
Copy link
Member

plusvic commented Sep 20, 2023

Notice that the workaround for 5 of ($s*): (#) relies on an implementation detail and is not guaranteed to work in the future. For more details see this: #1781 (comment)

Also, as mentioned in the discussion in the link above, (#s*) > 5 can lead to confusion, and be interpreted as "make sure that the number of occurrences for every pattern starting with $s is larger than 5".

It looks that there's some demand for this feature, we need to find the more appropriate way for expressing this .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants