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

Convenience for separator-delimited sequences #56

Closed
robrix opened this issue Jan 30, 2015 · 2 comments
Closed

Convenience for separator-delimited sequences #56

robrix opened this issue Jan 30, 2015 · 2 comments

Comments

@robrix
Copy link
Owner

robrix commented Jan 30, 2015

It’s super easy to parse e.g. (element + terminator) sequences:

(x ++ %";")*

But it’s a bit obnoxious to parse separator-delimited ones:

x ++ (%"," ++ x)* --> { [ $0 ] + $1 }

That’s a common, useful pattern, so it should be convenient, e.g.:

join(%", ", x) // overloading `join` is semantically reasonable but a bit strange
x * %"," // not a big fan of overloading * like this, and I don’t want to add too many more operators
@bencochran
Copy link
Collaborator

sepBy and sepBy1 added in 94b7985

(as I discovered after writing what turned out to be the same implementation… yay confirmation)

@robrix
Copy link
Owner Author

robrix commented Dec 2, 2015

Whoops! Good catch.

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