Bug Description

As per https:/ /markkarpov. com/post/ lisp-and- haskell. html :

There is a function mentioned in the above blog post, the full body of which is:

(defun add-text-padding (str &key padding newline)

"Add padding to text STR. Every line except for the first one, will be

prefixed with PADDING spaces. If NEWLINE is non-NIL, newline character will

be prepended to the text making it start on the next line with padding

applied to every single line."

(let ((str (if newline

(concatenate 'string (string #\Newline) str)

str) ))

(with- output- to-string (s)

(map 'string

(lambda (x)

(princ x s)

(when (char= x #\Newline)

(dotimes (i padding)

(princ #\Space s))))

str))))

The troublesome part is the (MAP 'STRING (LAMBDA (X) ...) STR) call. The anonymous function ends with a WHEN/DOTIMES call, which causes it to always return NIL. MAP 'STRING, in turn, requires that its function returns characters.

This information can be utilized by SBCL to emit a compile-time warning about mismatched types: the type exected by MAP and actual return type of the function.