How do I create custom functions?

Hi everyone :wave:

Can someone explain me how to create custom functions and add them in Tidal's system files, so that they are always available after booting?

Or, at least, can you tell me where to find more informations about this topic?

I suppose is important to know the Haskell language :upside_down_face:

Hi @cxtmp :slight_smile:

You are right, it has something to do with the haskell language. I suppose you want to create makros out of functions that are already exist?
You can i.e. just evaluate a new function in your current session like this:

fill e x = every e (fix (ply 3) (s x))

And use this custom function in your current session:

d1 $ fill 2 "hh" $ s "bd hh sn hh"

To make this custom function automatically availabe after booting you need to add it in your BootTidal.hs. I.e. in Atom you can specify a path to a custom BootTidal.hs.
In the custom BootTidal.hs you should add a custom block. Something like this:

let fill e x = every e (fix (ply 3) (s x))
    fill' e x = every e (fix (sply 3) (s x))
    updown = fastspread ($) [id, rev]
    -- ... more functions

This let is used to add several function and multi-line definitions at once. I guess there is some more to share, but this should answer the question. It was hopefully helpful for you :slight_smile:


Thanks a lot for your very kind and helpful answer @mrreason! :raised_hands:

I'd like to "dig deeper" in Tidal's ecosystem. Where did you learn all these things? Are you an Haksell programmer or did you only study this language to improve your Tidal skills?