Rotate in mini-notation

I've implemented the rotL and rotR functions in mini-notation. I'm not sure it's worth submitting a pull request. Is this something anyone else would want?

The code is here:

specifically in src/Sound/Tidal/ParseBP.hs, the function pRot.

I'm using the characters « and » to represent left-shift and right-shift, since < and > are already occupied as braces. « and » can be typed easily in Emacs via C-x 8 < and C-x 8 >, respectively. I don't know about other editors.

It interacts annoyingly when used in conjunction with pMult. I've documented that in the following comment:

-- | PITFALL: If they are both used,
-- @pMult@ should be applied before @pRot@.
-- That is, @d1 $ "bd*2«1%3"@ will works fine,
-- but @d1 $ "bd«1%3*2"@ gives a parse error.
-- (Order concerns can also be defeated with square brackets,
-- but that could be hard to read.)
1 Like

i've actually been thinking about this myself. I'm currently working on extending the mini notation to a full functional language on it's own here:

and i was currently implementing some of Tidals core functions when I encountered the fact that rotL and rotR cannot be represented solely by mini-notation (just consider rotL 1 $ "1/2"), so to actually use them i would have to introduce some syntax, like you.

i wonder, what was your motivation for implementing this?

also note that there is currently an open PR for a complete parser overhaul, which needs a little more work and disussion but is close to done

I'm currently working on extending the mini notation to a full functional language on it's own

That's exciting. Are there usage examples somewhere? What distinguishes the src/ and app/ folders? The README talks about compilation -- will it run on-the-fly like Haskell does? Can it be used in conjunction with ordinary Tidal-in-Haskell? It would be awesome to have two interpreters open and be able to refer from either to things defined by the other.

what was your motivation for implementing this?

I don't remember specific patterns but I know I've defined patterns and then wanted to rotate just some part of the pattern, which is hard to do when applying one of the rot functions "from the outside". There are ways but they're awkward and murder to refactor.

there is currently an open PR for a complete parser overhaul

Found it, on it, thanks!

Hey,
there are no examples yet since it's still a work in progress..
the app folder contains code to build the binary which currently asks for a minilambda expression, parses it, compiles it to haskell and interprets it and transforms it into a tidal pattern. The src folder contains the modules that are loaded interactively by the interpreter (i.e. a functional haskell representation of the minilambda language) and Prelude functions known from Tidal (like rev, rot, etc.)
the plan is that it will run on-the-fly, yes

That's actually a very good idea I haven't thought about and I think it's definitely possible!