iterate and insert the same element between each element of a list

coralie's icon

Hi

I have been browsing the [zl] objects as well as the RTC library. No success. Is there a [zl lace]-like tool that will insert the same single item between item of a list ?
For instance

List: 1 2 3 4
Item to insert a
Result: 1 a 2 a 3 a 4 a

I could use [zl length] to create a list with as many "As" as necessary, but it seems uselessly complex to me, and I'm not even sure the process is that straightforward. There might be a specific object already.

Thank you

Coralie

Pedro Santos's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I don't know of any, but here is one way of doing it using iteration

coralie's icon

Thank you Pedro. That's more or less what I had figured, just a bit smarter than my solution.

metamax's icon

If you bang the zl.group object, you don't need to set the number of elements.

Max Patch
Copy patch and select New From Clipboard in Max.