The print function prints to the terminal. Thus
typing
> (dotimes (k 5)
(print k) )
0
1
2
3
4
results in the integers 0 through 4 being printed to the terminal. Notice that Lisp loops begin by default at 0, like C/C++, but unlike Fortran.
I/O to files is handled nicely with streams. We can define a file stream as
> (def myfile (open "myfile" :direction :output)) MYFILE >(print "this is a test" myfile) "this is a test" > (close myfile) T
The direction is input by default. This code opens a file called myfile, writes a string to it and then closes the file. Formatted I/O is covered in Chapter 4 of [Tie90].