Question

I have this:

(loop for i below x
            do (update-world)
            if (zerop (mod i 1000))
            do (princ #\.))

It is working, except that all the princ invokations arrive at once, at the end. The idea here is that they are a progress indicator, printing a period to the screen every 1000 iterations. This is from the Land of Lisp book, and I'm wondering if expecting printing in the middle of a loop is not a portable expectation?

Was it helpful?

Solution

Add a (finish-output) after the princ.

http://clhs.lisp.se/Body/f_finish.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top