(uiop:define-package :binry-hop/updaters (:export #:iterate-memories) (:mix :binry-hop/util :cl) (:nicknames :hop-updaters)) (in-package :binry-hop/updaters) (defun iterate-memories (array memory-rereader) " closure (idx) -> array updated at idx Minimises current energy at an idx by iterating through memory-rereader. Note that your method of picking idxes factors into the Lyapunov condition that guarantees convergence. " (lambda (idx) (loop for (memory looped) = (funcall memory-rereader) summing (diff-diff-signs idx array memory) into energy-minimises while (not looped) finally (setf (aref array idx) (b2s energy-minimises)) (return (values array)))))