Using period(.dot) between two Control Function

I'm studying by looking at the codes of Kindohm.
I saw in the tutorial that period(.dot?) shortcuts are used for grouping,
but I don't know exactly how it works when it's located between two Control Functions as shown in the code below.

let spike p = ((# delaytime (range 0.001 0.3 $ slow 7.1 sine)) . (# delayfeedback (range 0.7 0.99 $ slow 6.71 sine))) $ p

I'm curious about the role of the dot between 'delaytime' and 'delayfeedback'.

Thank you!

Hey @eyd ! The dot (.) is the haskell operator for function composition which comes from math. When you are interested in a more in depth explanation with examples you might want to check this out: What is the dot operator in Haskell? | by Saeed Zarinfam | Medium

1 Like

Thank you. I'll check it out! :smile:

I also find this comparison between dot and dollar operator revealing.

(In my experience you can find some good explanations on Stackoverflow because mostly one problem will be explained from different perspective in one answer.)


I think that spike function is a bit simpler if rearranged so the . isn't needed:

let spike pat = pat # delaytime (range 0.001 0.3 $ slow 7.1 sine) # delayfeedback (range 0.7 0.99 $ slow 6.71 sine)

But yep, as you imply in your question, the . in the mini notation (for grouping or marking out metrical 'feet') is unrelated to its use outside the mini notation.

The above links are great for in-depth understanding of its general use in Haskell.

In Tidal though, it's almost always used for one thing. Lets take jux for example, it takes a function and a pattern as inputs, like jux (hurry 2) (sound "bd sn"). What if you wanted to chop it up as well? Then you can use . to combine functions together, e.g. jux (hurry 2 . chop 64) (sound "bd sn"), and add a reverse as well like jux (rev . hurry 2 . chop 64) (sound "bd sn").

So . is used to join together two functions together. It only works if the output of the second function can be fed into the input of the first function. In Tidal it's mainly used for joining together Tidal functions which simply take a pattern as input and return a pattern as output, like fast 2, rev, scramble, (# squiz 1.1), etc.