Sanna and sankhara as algorithm

from the five aggregates, sanna and sankhara appears to be like the heart of an algorithm. sanna is accessing our evolutionary survival data in the DNA perhaps to recognize streaming input(sensory) data. sankhara is responding(output) based on the stored data/past experiences/habit patterns. sanna in this sense is also storing and arranging all data for future reference. it is mechanical and automated because the whole process happens at far beyond the speed of normal consciousness.

makes any sense?

In order to change perception the mechanism must be slowed down, and that’s the role of samadhi.

"“And what are skillful resolves? Being resolved on renunciation (freedom from sensuality), on non-ill will, on harmlessness. These are called skillful resolves. What is the cause of skillful resolves? Their cause, too, has been stated, and they are said to be perception-caused.”— Majhima Nikaya 78

These are right intentions, the second link of the noble eightfold path, which result from right view.

"“Monks, there are these four perversions of perception, perversions of mind, perversions of view. Which four? ‘Constant’ with regard to the inconstant is a perversion of perception, a perversion of mind, a perversion of view. ‘Pleasant’ with regard to the stressful… ‘Self’ with regard to not-self… ‘Attractive’ with regard to the unattractive is a perversion of perception, a perversion of mind, a perversion of view. These are the four perversions of perception, perversions of mind, perversions of view.”—Anguttara Nikaya 4.49

This shows in reverse order how perceptions are a result of views, and views can be changed by investigation.