To be honest, there are some very heavily edited videos out there where they not only delete every “um”, “ah” but also most of the breaths and gaps between words; I usually find those very irritating and artificial. This video looked good to me!
I've been introduced to programming using languages with no significant white space, so I usually get tricked by indentation when interacting with Tidal
I don't know if this is the right time to ask but I'd love to see some tips to get indentation right, maybe in a future video
You could try to toggle invisibles and toggle indent guide from the command palette in atom to have a visual cue of them. There are some packages as well that color the indent guides so that you can see when you’re inside an indent block in your code. Hope that helps
Good questions, I’ll do a proper, detailed breakdown of this very soon. In brief though you can think of d1 as a connection to (super)dirt. $ separates a function (in this case d1) from an input (in this case the pattern you’re passing to it, sound "bd sd"). Without it, d1 would only receive the sound, and the "bd sd" would be left dangling. An alternative is to use parenthesis like d1 (sound "bd sn"), that works but that can fiddly matching up the opening and closing brackets, when the pattern gets more complicated.
"bd sd" is a pattern of words, sound turns it into a pattern of sounds, and $ makes sure that happens before it’s given to d1, which then generates events from it to send to superdirt.
The dollar is Haskell syntax, and is probably the hardest thing to get your head around with Tidal. It takes a while before it ‘clicks’, but the good thing is that it really doesn’t much harder than this…
One thing I now find quite weird with the $ is that in your description it seems to do 2 different things at once. 1. « separate a function from an input » (ok) 2. sort of replace parenthesis, which seems quite different. Especially, how does the $ « knows » where the virtual parenthesis ends ? Why is d1 $ sound « bd sd » correctly understood as d1 (sound « bd sd ») and not, say, d1 (sound) « bd sd », with the « bd sd » left dangling ? Is it because the $ does something like « everything on my right is one input, stretch the virtual parenthesis till the end of that line of code » ?
Not sure I am clear in my confusion !
Yes it’s strange. I suppose you can think about the parenthesis here d1 (sound "bd sn") as separating the input sound "bd sn" from the function d1 too.
Or maybe it’s easier to think about changing the order of how things are “worked out”? It’s the same as in arithmetic, (1 + 2) * 3 gives a different result (9) from 1 + (2 * 3) (which equals 7). Without parenthesis, 1 + 2 * 3 would equal 7, the same as the latter, because there’s an arithmetical rule that * takes precedence over +.
It might also help if I explained what $ actually does. Just like +, it’s an inline operator. It takes two inputs, a function (on its left) and an input to pass to that function (on its right). Then it passes that input to the function and returns the result. This is its entire definition: f $ x = f x. That’s it! It’s so simple that it’s difficult to understand. It’s almost like it’s doing nothing at all.
Pretty much the only thing that makes $ useful is that (just like +) it has very low precedence. In fact I believe it has the lowest possible precedence. This means that anything on its right hand side will be “worked out” first, before it gets hold of the result, to pass to the function on the left.
Does that help? Probably not… But don’t worry, we’ll work with lots of examples and the usefulness of $ with slowly become clear.
YES, this very much helps. It’s been about a year since I’ve touched tidal and this is the kind of stuff that really helps when you’re first fiddling around or coming back to it. Otherwise, I find myself “experimenting” in a bad way – i.e., doing stuff and having no real grasp of what’s happening.
Understanding how the functions and controls, etc. interact is pretty crucial – at least I’ve found it to be. Thanks for this.
Execute them one by one with Shift-Enter and watch the output in Atom’s status window at the bottom:
Note how in the first example (lacking the $) the sort function applies only to “julie” and “moronuki” is simply appended, while in the second example (including the $), “julie” and “moronuki” are concatenated before the resulting string “juliemoronuki” is finally sorted.
import Data.Char -- package providing "toUpper" to make a single character upper case
uc xs = [ toUpper x | x <- xs ] -- our own function "uc" to make a string all caps
uc "julie" ++ "moronuki" -- uc is applied only to julie, moronuki is added after the fact
uc $ "julie" ++ "moronuki" -- uc is applied after julie, moronuki have been concatenated.
t>"JULIEmoronuki" -- uc is applied only to julie, moronuki is added after the fact
t>"JULIEMORONUKI" -- uc is applied after julie, moronuki have been concatenated.
Thanks @loopology. It’s worth noting though that this example is for working with lists, and Tidal isn’t based on lists but functions. So, in case anyone is wondering about the syntax here with ++ and <- etc, you’re unlikely to need that for tidal, so don’t worry about it.