< Back to IRCAM Forum

Triggering a patch

how-does-this-work.opat (14.3 KB)

In the attached patch (you can ignore most of the details),

  1. Loading the patch and clicking ‘mapcar’ produces ‘Nil’. Why doesn’t it show a list of 4 integers, because…

  2. ‘choixmultiple’ correctly produces a single integer and ‘iterate’ correctly produces a list of 4 integers… after which, clicking ‘mapcar’ correctly produces a list of 4 integers.

When I incorporate (a version of) this (simplified) patch in another patch, it always returns the ‘Nil’ as if it never was triggered.

What am I not getting?

Many thanks.

PS: Since " Evaluation

Evaluating a box means calling its inner function and parameters. If this box is connected to others, all the upstream boxes will be evaluated one by one. Thus, evaluating one box can trigger a more or less lengthy evaluation chain. This chain refers to the calculus of a function tree, or, in other words, of the visual program."

why doesn’t evaluating ‘mapcar’ cause “all the upstream boxes will be evaluated”?

You are using here two special boxes:

collect has a memory, which is set when eveluated on its first input. When you just evaluate mapcar on your example, the memory is empty. You can trace this back by evaluating the output of the boxes above: it is generally usefull to better understand what happens.

iterate will pull the first output of collect several times, and fill the memory accordingly. So mapcar then works as expected on the recorded list.

It does evaluate all upstream boxes recursively (until one boxes blocks it). Locked boxes can block evaluation. In your case, evaluating a collect on its second output is also blocking further evaluation.