Is there a way to transform a pattern into a pattern of Booleans, with rests mapped to false, and anything else mapped to true? For example
"~ 2 ~ 2" becomes
"f t f t".
I have tried this, which I thought could work for positive integers:
(> 0) <$> "~ 2 ~ 2". However, while numbers are mapped true, rests seem to be mapped to nothing. And unfortunately, many functions like
while etc, require the false values to be there.
And a further question, can anyone point me to the documentation for
<$>? It is ungooglable!