-
Notifications
You must be signed in to change notification settings - Fork 809
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
Add fold_count
parser equivalent for count
#1401
base: main
Are you sure you want to change the base?
Conversation
This is already possible with |
Ok((i, o)) => { | ||
acc = fold(acc, o); | ||
input = i; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be a check inside this loop to see if the child parser actually consumed any input. The child parser not consuming input inside a loop is an error condition. See fold_many_m_n
for an example.
You could say the same about |
There are some convenience parsers that allow you to avoid using fold_* (such as many_*). But I think thats a bit different from adding another fold_* parser. My current problems with this:
|
At least name it |
I think you mean |
in math, |
I dont think thats a set rule. n is often used to denote a number of something. However in math one also often uses x or even a. It usually comes down to preference and context. To my knowledge there is no strictly enforced order of variable names, there are some conventions but those are not mandatory and only apply in their respective context.
Irrelevant. This parser is about the case of |
how irrelevant, that stupid, obviously this is for max only so take
yes why not |
The only obvious thing is that |
I will repeat so, no that different you don't understand. if you take |
This case is also handled by #1402 which in my opinion is a much more elegant solution compared to adding yet another specialized parser. |
This should be solved by #1608, which allows |
No description provided.