(defun iterate-memories (array memory-rereader polynomial) "
closure (idx) -> bit array updated at idx
Minimises current energy at an idx by iterating through
memory-rereader (see it and make-rectified-polynomial)
Note that your method of picking idxes factors into
the Lyapunov condition that guarantees convergence. "
(lambda (idx)
(loop for (memory looped) = (funcall memory-rereader)
while (not looped)
when memory
sum (diff-diff-signs idx array memory polynomial)
into energy-minimises finally
(setf (aref array idx) (s2b energy-minimises))
(return (values array)))))