If you want to declare that the function takes a fixnum and returns a fixnum, you can use a function type declaration:

  (declaim (ftype (function (fixnum) (values fixnum &optional)) foo))
Of course, if you pass a fixnum and the result cannot actually be stored in a fixnum, that's no good. So you need to either handle that case or not make such a declaration.

for a specific expression on can also specify the return type using THE:

    (the fixnum (+ a b))

That’s a hilarious but perfect piece of syntax. Do you know where it originated?

agreed^^ there are macros and libraries to bring a nicer syntax (of course). Exple: https://github.com/lisp-maintainers/defstar

   (defun* (sum -> real) ((a real) (b real))
       (+ a b))