aboutsummaryrefslogtreecommitdiff
path: root/ch-2.lsp
diff options
context:
space:
mode:
Diffstat (limited to 'ch-2.lsp')
-rw-r--r--ch-2.lsp15
1 files changed, 15 insertions, 0 deletions
diff --git a/ch-2.lsp b/ch-2.lsp
new file mode 100644
index 0000000000..8cce700264
--- /dev/null
+++ b/ch-2.lsp
@@ -0,0 +1,15 @@
+(setf n 4)
+(setf a '(0 1))
+(setf m (- n 1))
+
+(loop for i from 1 upto m do
+ (setf 2power (expt 2 i))
+ (defun add2pow (terms) (+ 2power terms))
+ (setf b (reverse a))
+ (setf b (mapcar #'add2pow b))
+ (setf a (append a b))
+)
+
+;;now the variable a stores the n-bit gray code sequence
+
+a