-
Notifications
You must be signed in to change notification settings - Fork 51
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 cycles of differing lengths #41
Comments
I am not sure we want to support that in the implementation of You can write a helper function for this pretty easily: def force_add(cyc_a, cyc_b):
try:
return cyc_a + cyc_b
except ValueError:
return cyc_a * len(cyc_b) + cyc_b * len(cyc_a) Might be worth adding a version of this (that uses least-common-multiple?) to the docs? |
Another operator could be used for this, maybe edit |
What is the use-case for this? |
As an example, say you want to cycle through three colors
But another operator to automate this would save code. And in contrast to the multiplication of two |
Yes please. I think this is a very common use-case for publishing where best-practices for reproducibility assume colors can't be distinguished, and so require unique combinations of |
In what use-case is the exception more beneficial? |
There is an ambiguity in adding two un-equal length cyclers. @bjmuld is making the case for implicitly extending it so On the other hand, you could make the argument that We chose to raise because it is not clear (at least to me) which of those two behaviors is the "expected" one. On one hand, there is clearly a use for the LCM version, but on other hand the min-length version is consistent with Maybe the LCM version is a candidate for |
Actually, it depends on the intention if you want MIN or LCM. a) Adding a secondary property -> MIN
When really thinking about it, LCM is a bit strange: We want to change both properties synchronously for every element (without the synchronous requirement we can simply use I would be fine with implementing the |
My only displeasure in the product operator is the order of the generated sequences. |
For sequences whose lengths are relatively |
It would be nice to be able to add cycles of differing lengths whose properties cycle independently.
The text was updated successfully, but these errors were encountered: