read-line-with-message on Lisp
There are a lot of cases that waiting user input from STDIN after show some messages. Terminal output likes below on that case.
What your name?:
Waiting user input can be done with read or read-line on Lisp, but we have to use other functions to show the message, for example format or princ. It is a small function, but sometime this implementation makes source code complicated because these functions should be used within progn. Bad code example is below.
(if (null NAME) (progn (format t "What your name?:") (setf NAME (read-line))))
I feel this is ugly. I would like to remove progn in above code. Small function enables to remove progn.
(defun read-line-with-message (msg) (format t "~A" msg) (read-line))