-
Notifications
You must be signed in to change notification settings - Fork 1
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
Patterned expressions #36
Conversation
Benchmark for 59aa142Click to view benchmark
|
Benchmark for e66ef7dClick to view benchmark
|
Looks good to me. Given this a quick try and things works fine so far. While testing, I've noticed that negative numbers are allowed in the right side expressions for Example: emit = cycle("c8*<0 -1>") Let me know if you want to merge this now or if you want to add support for bjorklunds as well. |
I was thinking of adding support for bjorklund but the fact that there are three arguments there that would need to be combined in multiple ways got me a bit stuck. We'd need a more general function here that could merge event streams into each other. Something like In strudel, negative numbers will silently apply zero basically, resulting in empty chunks. I wonder how hard it could be to implement a reverse functionality that could be used when the multiplier is negative. |
Just wanted to report this issue here: Right side expressions of This works: This fails to parse: Seems to be fixed in this branch too. The changes are useful already. Let's clear and merge them, and deal with the Bjorklund parameters in a new PR? |
Let's do that! |
7209353
to
e0da30a
Compare
Benchmark for 4639dbeClick to view benchmark
|
Wanted to update the limitations in the API docs, but am a bit unsure here:
Does that make sense?
|
That doesn't sound right. Operators should work for Bjorklund, what is not supported is patterned parameters for it. These should be fine:
This is not supported:
|
Currently doesn't work. Also fine with me to postpone a fix for this. decide you... |
Oh true, I've missed that. Unfortunately operators are read right recursively (to satisfy the peg parser spec) and that's also how they are applied so stacking operators is actually not working properly. Note, this is not specific to Bjorklund, things like |
Benchmark for 89b4997Click to view benchmark
|
I've implemented patterns on the right side of expression
*
/
and%
.While the same thing for Bjorklund parameters still has to be done, these seem to work fine.