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

Can pomsky provide a permutations operation? #78

Open
pansila opened this issue Feb 19, 2023 · 2 comments
Open

Can pomsky provide a permutations operation? #78

pansila opened this issue Feb 19, 2023 · 2 comments
Labels
C-language Issues regarding Pomsky's syntax enhancement New feature or request

Comments

@pansila
Copy link

pansila commented Feb 19, 2023

Is your feature request related to a problem? Please describe.

It's cumbersome to list all permutation of anded patterns, this can be done as a sugar syntax in pomsky?

Describe the solution you'd like

In pomsky: 'fox' & 'dog'
In regex:.(?:fox.*?dog|dog.*?fox)

Describe alternatives you've considered

Not yet

Additional context

No

@pansila pansila added the enhancement New feature or request label Feb 19, 2023
@Aloso Aloso changed the title Can pomsky provide an 'and' operation? Can pomsky provide a permutations operation? Feb 19, 2023
@Aloso
Copy link
Member

Aloso commented Feb 19, 2023

I wouldn't call this an 'and' operation. You can think of regular expressions as sets, and | creates the union of two sets. Logically, & would be the intersection of two sets, which is rarely useful.

I'm not sure if permutation deserves dedicated syntax, and if we decide to implement this, it won't use the & symbol. Available symbols are: ~@$%/-,<>

@Aloso Aloso added the C-language Issues regarding Pomsky's syntax label Feb 19, 2023
@pansila
Copy link
Author

pansila commented Feb 19, 2023

Sure, what ever you call it is okay, I mean the need for this is real, it's useful to search a line with all patterns match no matter the order, like I want a line with both keywords of 'fox' and 'dog' in. Otherwise, I have to filter out all lines with 'fox' matched, then filter again over the results with 'dog' matched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-language Issues regarding Pomsky's syntax enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants