< Back to IRCAM Forum

Recurse on a function: (f (f (f (f ... (x))))) in OpenMusic

Hi Group… Is there a quick way to do this kind of function call (f (f (f (f (x))))) in OpenMusic? Say I would pass a lambda (which is the function f, a OpenMusic patch) and an niter (the number of times I want to compose the function) to a function say “recurse”? Function “recurse” cannot be a lispfun because the function to recurse on is an OpenMusic patch… Any ideas?

Hi Philon,

If i get you right, you need to use omloop with the accum operator like this:

[the patch:]
accum.omp (4.8 KB)

Read more here:
http://recherche.ircam.fr/equipes/repmus/OpenMusic/user-doc/DocFiles/Tutorial/tut036/Index.html

Best
K

1 Like

Sounds good! Thank you so much!

Hi Philon. If you want recursive calls - which may be very useful to control various conditions during iteration - it’s possible in OM (because it’s such a great tool!) - check tutorials 38-40.

-anders