< Back to IRCAM Forum

Lists of sums taken from sublists

Hello,
I am struggling with troubleshooting the omloop in the following patch:


I have the default input set to the following list:
(8 7 11 4 10 3 2 11 4 10 8 7 6 9 5)
This is one possible result of another omloop function I created. The group-list function is working fine; the result should be:
((8 7 11 4 10) (3 2 11 4 10) (8 7 6 9 5)).
I am trying to create an omloop function which returns a list of the sums of each sublist taken from the result of the group-list function. So the ultimate result (given this default input) should be:
(40 30 35)
The omloop I’ve designed looks like this:

The internal “sumloop” looks like this:

When I run the results of the omloop (not the “sumloop”), I get the following:

I can see that the output of the “eachtime” evaluator is correct, i.e. that I am getting results 40, 30, and 35 as intended. Why, though, is the “finally” output giving me the original list of sublists, and not the list of their sums as I had hoped?

Thanks in advance for taking a look at this.
Theo

Dear theokoskoff,

If I understood your request correctly you could use the MAPCAR function in combination with REDUCE in Lambda mode.

I hope I understood your request and gave a useful suggestion.

Regards

neo

1 Like

This is exactly what I’m looking for, and much simpler! Thank you.

1 Like