< Back to IRCAM Forum

Count successive repetitions of items of a list

Hi to all,

I have a list: (a a a b b a b c) or (0 0 0 1 1 0 1 2), and I need a patch (or loop) that would group successively repeated elements like ((a a a)(b b)(a)(b)©) or ((0 0 0)(1 1)(0)(1)(2)).
The other way would be to count the elements that are repeated in succession (3 2 1 1 1), but both methodologies overcomes my (graphical) programing skills. Please, can anybody help me out here?

Many regards!
Aliser

Hi Aliser,

This is what I got. Look at the screeshot:
1 in the lambda patch I track equalities between elements (t t nil t nil nil nil nil) in the list of letters you gave me
2 in the loop I count the true statements by means of a counter attached to a sequence (the sequence triggers the counter but only reports its count when it meets a nil statement)

It should work but let me know in case…

Michele

Screen-Shot-2014-09-17-at-6.29.59-PM.tiff (3.27 MB)

Dear Michele,

Thank you very much! It works perfectly!

Many greetings!

Aliser