#!/usr/bin/sbcl --script
(defvar a)
(defun main ()
;(write-line "Yes or no?"); This works in the correct order
(print "Yes or no?")
(setq a (read))
(print a))
(main)
When executed it prompts for input and only after giving the input it prints "Yes or no?"
(where my intention is for it to first print "Yes or no?"
then take input). When I swap print
for write-line
the order is as expected, though.
Why does write-line
behave so differently from print
in this case? Why does it seem that the order of execution is not top->down in this function? I want the function main execute print
and read
in the order that they appear
in the source file. How might I accomplish this?