I want to do some integer arithmetic and was checking if SBCL could gain more speed if I provide explicit information about the type
of values I use. While I easily could use declare
in a defun
or let
directly to do so, I do not understand where to put the statement within a loop
construct.
I came across the documentation of the iterate
package which offers such possibilities but wanted to stick to loop for the moment.
A stub example could look like this:
(loop :for i from 1 upto 100 :collect
(loop :for j from i upto 100
:collect (* i j)))
How can I tell Lisp that i
and j
are e.g. of type fixnum
?
of-type
makes code concise, but, IMO, less readable. – Latinist