Simple (?) recursion problem. Can M4L even do recursion?!
In this simplified version of my patch, I am trying to use an [uzi] recursively, but it won’t work. :( I don’t necessarily need the [uzi], but I need to be able to do recursion.
Here’s a cheesy view of the problem:
. ______________ | | Clicking the message ["5"] gets... ["5"] ["2"] | | / | 1,2,3,1,2,4,3 | / | | / | If [uzi] supported recursion, [_uzi _ _ ] | then output would be... /| | / | | 1,2,3,1,2,4,5 / | | / | | ...which is what I want. / | | [print] [select 4] | |__________|
How can I simulate recursion in this example?
Are there M4L objects that *do* support recursion?
Thx in advance,
It seems that Max objects are generally not designed to handle "recursive calls", but the behavior can be simulated by using multiple instances of the object. Do you think that’s a serious limitation in practice?
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 408.3ocyV9saCBBEF+Z8ofv0tFw+V2cauFKMKTk0xhBFAy5ZSe2GfZZ6V6p0 nc6FI7Agy24mmC5NaK3R9Fh.BdD7BvxZmskkQRKX0N2BVf2jliElsAYjO3Ke G5zrjjrQZjq2R6zdiyjLbAwn+TEEmCdlmm0sLqtfxxIRyw40JVhkoqorUuVQ RkM1AEGNy0A34EqGBhzOQym4BVbTbDzsl3fbUK2HSyLAVYxGPtGETdsrKp9s pMRxOKIMgDtDyVAcNLRYJyrPu48115GN8jREDg.uh7CL4MMPBkDnG78lEplD cSPJ47LBcIFMLfbgxlxJMhG.SP+BSb8MENwlBGe+AT3Dedl3NdItfjqLLHXh pGBmaZZhGPtGc9b26Z8LiaiR3XClfDMKZqIFReR3eYexDb8ZfoDAgBF70q9i 8sqlXCyoru+IIi+05mRNAutJs6zaqcAGxfLhPRYXIkyNZOImrm0zrLhY4tDr flUxUVq0BW3sXecjhQ.uq3nn6piB6Ai7+2wn36piR5Aiz+bwczRlvMkTRMYu 8WfAc8j7 -----------end_max5_patcher-----------
Hi Broc, thx for replying.
The example above is just a simplification. My actual goal here is to generate a list of all devices on the track, including those in all chains, by traversing the track’s device hierarchy recursively. I don’t know the depth of the hierarchy beforehand.
Right now I’m trying to simulate using [zl stack], but having trouble. :(
Yes, recursion can generally be simulated/implemented with a stack.
Forums > Max For Live