Mininotation: Can {}% polymeters be used with [..] lists?

I would expect this example

do
  d1 "cp"
  d2 $ n "{0..7}%3" # s "supervibe"

to play three notes per cycle, but instead it plays 24 notes, at 3x the base speed.

Here are some other things I tried, but the behavior did not change:

d2 $ n "{[0..7]}%3" # s "supervibe"
d2 $ n "{~ ~ ~, 0..7}" # s "supervibe"
d2 $ n "{~ ~ ~, [0..7]}" # s "supervibe"

I’m guessing the answer is no, based on the differing type definitions:

t> [0, 1] :: Num a => [a]
t> [0..1] :: (Num a, Enum a) => [a]

no, that is not the answer. the meaning of [0 .. 1] is defined by the Haskell language standard. you are asking about the meaning of mininotation string "[0 .. 1]", which is defined by tidalcycle's parser (in this area of the code https://codeberg.org/uzu/tidal/src/branch/main/tidal-core/src/Sound/Tidal/ParseBP.hs#L210 )

the pattern (that you observe)

ghci> queryArc ("{0 .. 1}%3" :: Pattern Int) (Arc 0 1)
[(0>ā…™)|0,(ā…™>ā…“)|1,(ā…“>½)|0,(½>ā…”)|1,(ā…”>ā…š)|0,(ā…š>1)|1]

is not the same as

ghci> queryArc ("{0  1}%3" :: Pattern Int) (Arc 0 1)
[(0>ā…“)|0,(ā…”>1)|0,(ā…“>ā…”)|1]

instead, it is equivalent to (note the extra brackets)

ghci> queryArc ("{[0  1]}%3" :: Pattern Int) (Arc 0 1)
[(0>ā…™)|0,(ā…™>ā…“)|1,(ā…“>½)|0,(½>ā…”)|1,(ā…”>ā…š)|0,(ā…š>1)|1]

NB: there seems to be an unnecessary restriction in the parser (it does not accept a blank after the number)

ghci> "[0 .. 1 ]" :: Pattern Int
*** Exception: Syntax error in sequence:
  "[0 .. 1 ]"
          ^  
unexpected " "
expecting "-", "+", digit, "c", "d", "e", "f", "g", "a", "b", "[", "{", "<", "^", "'", rest, ".", "?", ",", "|" or "]"

2 Likes