## opposite of change?

Oct 23, 2013 at 9:23am

# opposite of change?

hey,

i only want to keep the repetitions in a stream of numbers,

so if its like 46 42 36 36 36 36 42 i want to “isolate” 36 36 36 36

thanks!

#268904
Oct 23, 2013 at 9:29am

Something like this?

<code>

– Pasted Max Patch, click to expand. –

</code>

#268905
Oct 23, 2013 at 9:42am

This works, but you may add a copy of the repeated number to the output, because i misses the first one before it gets that it’s repeating.

<code>

– Pasted Max Patch, click to expand. –

</code>

#268906
Oct 23, 2013 at 9:44am

Do you need all four 36s in the above example? If so, here’s a slightly different take which compares it against two neighbors. (I’ve included Mike S’s for comparison)

<code>

– Pasted Max Patch, click to expand. –

</code>

#268908
Oct 23, 2013 at 9:50am

:-)

#268911
Oct 23, 2013 at 10:11am

pretty hard to compare a number to the next number in a stream ^^

#268917
Oct 23, 2013 at 11:00am

Yeah, there’s a latency of one value, but you also correctly identify all values in the long run. Can’t have it both ways…

#268920
Oct 24, 2013 at 9:52pm

With a simple modification to output the initial integer, Mike S.’s approach is almost twice as fast as the others..

– Pasted Max Patch, click to expand. –
#269058
Oct 25, 2013 at 6:34am

thanks all!

(still have not looked at the patches though…as im trying to solve it in an easy way.:)

#269096
Oct 25, 2013 at 6:48am

I stand corrected. Nice solution, Metamax.

@FlowDesigner Here’s an encapsulated, drop-in ready version of Solution A (Mike S./Metamax).

<code>

– Pasted Max Patch, click to expand. –

</code>

#269099
Oct 25, 2013 at 4:59pm

yet another solution. Maybe not the most efficient, but with fewer objects:

<code>

– Pasted Max Patch, click to expand. –

</code>

#269162

You must be logged in to reply to this topic.