struct somehow be used more like a boolean function? for example what if a
structWith function existed:
structWith functionIfTrue functionIfFalse structure
d1 $ structWith (# speed 2) (# gain 0) ("t f*2 t*2 [t f]") $ s "arpy"
d1 $ structWith (|+ n 1) (# pan 1) ("t f*2 t*2 [t f]") $ s "arpy" # pan 0 # n 3
Instead of just turning the
struct be used to supply my own function for what to do on the
Hi Mike, howabout this:
-- | chooses between a list of functions, using a pattern of integers
pickF :: Pattern Int -> [Pattern a -> Pattern a] -> Pattern a -> Pattern a
pickF pi fs pat = innerJoin $ (\i -> _pickF i fs pat) <$> pi
_pickF :: Int -> [Pattern a -> Pattern a] -> Pattern a -> Pattern a
_pickF i fs p = (fs !!! i) p
Then you can do this:
d1 $ pickF "<0 2> 1 2" [(# crush 4),(# djf sine),iter 4] $ n (run 8) # sound "bd"
Thanks @yaxu. Indexing into a list of patterns isn’t exactly what I had in mind, but I think it will solve my issue perfectly.