Mini notation vs. euclid

Hey, I ran into the following weirdness and can't really figure out what's going on:

in my opinion the following two patterns should produce the same sound:

d1 $ while (euclid 1 8 $ "t") (# speed 2) $ s "bd sn"

d1 $ while "t(1,8)" (# speed 2) $ s "bd sn"

but in the first one, the "sn" disappears for me. Anyone have an idea why?

Prelude Sound.Tidal.Context> euclid 1 8 "t" :: Pattern Bool
(0>⅛)|True
Prelude Sound.Tidal.Context> "t(1,8)" :: Pattern Bool
(0>⅛)|True
(⅛>¼)|False
(¼>⅜)|False
(⅜>½)|False
(½>⅝)|False
(⅝>¾)|False
(¾>⅞)|False
(⅞>1)|False

and while p a will mute a when p is silent, but use it unchanged when p has a False event.

NB: I find these ghci commands helpful:

find comments (API doc) embedded in source code:

Prelude Sound.Tidal.Context> :doc while
 A binary pattern is used to conditionally apply a function to a
 source pattern. ...

for that to work, compile Tidal with -haddock (put ghc-options: -haddock in ~/.cabal/config)

when still in doubt, find source location:

Prelude Sound.Tidal.Context> :i while
while :: ...
  	-- Defined in ‘Sound.Tidal.UI’
1 Like

Ah thanks this makes sense.
I suspected something like this, but when trying to evaluate "t(1,8)" :: Pattern Bool it gave me an error complaining about a missing IsString instance for Bool..

There is no real reason, that the euclid function doesn't produce the False events, i guess?
otherwise I'm gonna implement it I guess

"makes sense", well it explains what's happening but not why?

You noted that "t(1,8)" :: Pattern Bool is different from euclid 1 8 (pure True). Since "t" :: Pattern Bool is pure True, this seems to break an (implied, assumed) axiom of compositionality.

That seems intentional, viz. euclidOff and euclidOffBool in Tidal/ParseBP.hs at main · tidalcycles/Tidal · GitHub (and nearby). But, I don't see where that intention is explained.

The function you want may already exist, see (Tidal/UI.hs at main · tidalcycles/Tidal · GitHub)

ah yes you're right, thanks!