opposite of change?


    Oct 23 2013 | 4:23 pm
    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!

    • Oct 23 2013 | 4:29 pm
      Something like this?
    • Oct 23 2013 | 4:42 pm
      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.
    • Oct 23 2013 | 4:44 pm
      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)
    • Oct 23 2013 | 4:50 pm
      :-)
    • Oct 23 2013 | 5:11 pm
      pretty hard to compare a number to the next number in a stream ^^
    • Oct 23 2013 | 6:00 pm
      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...
    • Oct 25 2013 | 4:52 am
      With a simple modification to output the initial integer, Mike S.'s approach is almost twice as fast as the others..
    • Oct 25 2013 | 1:34 pm
      thanks all!
      (still have not looked at the patches though...as im trying to solve it in an easy way.:)
    • Oct 25 2013 | 1:48 pm
      I stand corrected. Nice solution, Metamax.
      @FlowDesigner Here's an encapsulated, drop-in ready version of Solution A (Mike S./Metamax).
    • Oct 25 2013 | 11:59 pm
      yet another solution. Maybe not the most efficient, but with fewer objects: