Simplify rev
yaxu opened this issue · comments
I think @polymorphicengine pointed out that rev could just negate time, rather than the complex mirroring it's doing now.
Here's an implementation of that:
negateArc (Arc b e) = Arc (negate e) (negate b)
rev' = withQueryArc negateArc . withResultArc negateArc
Can we drop this in or does it have different behaviour? I think it's similar but the cycles are also in reverse order?
for comparison:
Tidal/src/Sound/Tidal/Pattern.hs
Lines 813 to 845 in 493b2c0
A quick test worked great! Wow, what a simplification.
i guess the difference comes in once a pattern is longer than one cycle:
currently rev <[1 2] [3 4]> == <[2 1] [4 3]>
, but with the above (i think) it would be <[4 3] [2 1]>
, so yes the cycles are also in reverse order
i think both behaviors are useful
Yes we could call the new one something like revall
or revpat