Shammer's Philosophy

My private adversaria

Create a sequence list with Lisp

This is like a seq of shell command which is used like below.

$ for i in `seq 1 10`;do echo $i;done
1
2
3
4
5
6
7
8
9
10
$

Here is a lisp code.

(defun seq (start end)
  (declare (integer start) (integer end))
  (loop for i from start to end collect i))

This is used like below.

? (dolist (x (seq 1 10)) (print x))

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
NIL
? 

Umm, this may be a nonsense function because loop provides similar function already...