(defvar foo-i 0)
(defun foo ()
(while-no-input
(while (< foo-i 10000)
(print (cl-incf foo-i))))
(when (< foo-i 10000)
(run-with-idle-timer 1 nil #'foo)))
Make a copy of all that, search-replacing "foo" with "bar". Run (progn (foo) (bar)). Both loops will complete eventually.EDIT: OK, you explained what you call the normal way to do things. What kind of code is this that take >1 second in each repl? Out of curosity.