There is no built-in way of generating a sequence of numbers, the canonical way of doing so is to do one of:
- Use
loop - Write a utility function that uses
loop
An example implementation would be (this only accepts counting “from low” to “high”):
(defun range (max &key (min 0) (step 1))
(loop for n from min below max by step
collect n))
This allows you to specify an (optional) minimum value and an (optional) step value.
To generate odd numbers: (range 10 :min 1 :step 2)