I am very new to Mathematica and have to rethink my ‘procedural’ ways of programming. That is not always easy. I am making progress, but here I have no clue, besides going down the ‘repeat and if’ rabbit hole.
I create a list of random integers.
I have a Dynamic Slider to adjust delta (between 0 and 20).
Let’s say the Slider is adjusted to value 10.
Now I want all the integers in the list that are 10 or less apart, to become the same integer.
E.g. myIntegers = {11,28,66,36,94,8,44}
After the ‘treatment’ the list should be :
{11,28,66,28,94,11,44} The 36 is within 10 from 28 and the 8 is also within 10 from 11, so in both cases the integer within the delta range gets to be the value of the first (36 becomes 28).
How could I go about this problem in a functional or symbolic way?