The REPL prints the value of each expression it executes
If you use the READ EVAL PRINT LOOP, the REPL will print the result. That's why it is called Read Eval Print Loop.
But output functions themselves will not print their result.
CL-USER 1 > (format t "hello") hello ; <- printed by FORMAT NIL ; <- printed by the REPL CL-USER 2 > (format t "world") world ; <- printed by FORMAT NIL ; <- printed by the REPL
Now combine the above:
CL-USER 3 > (defun foo () (format t "hello") (format t "world")) FOO CL-USER 4 > (foo) helloworld ; <- printed by two FORMAT statements ; as you can see the FORMAT statement did not print a value NIL ; <- the return value of (foo) printed by the REPL
If you return no value, the REPL will print no value.
CL-USER 5 > (defun foo () (format t "hello") (format t "world") (values)) FOO CL-USER 6 > (foo) helloworld ; <- printed by two FORMAT statements ; <- no return value -> nothing printed by the REPL
You can execute Lisp code without a REPL
If you use Lisp without a REPL, no values are printed anyway:
$ sbcl --noinform --eval '(format t "hello world~%")' --eval '(quit)' hello world $
Alternatively you can have Lisp execute a Lisp file:
$ cat foo.lisp (format t "helloworld~%") $ sbcl --script foo.lisp helloworld $
The actual command lines are implementation specific.