diff options
| author | Fung Cheok Yin <61836418+E7-87-83@users.noreply.github.com> | 2020-07-26 18:20:28 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-26 18:20:28 +0800 |
| commit | 3fca1475f6afffcb7cdddaec7dbdc2ea0b521b67 (patch) | |
| tree | 09b3b4ff238bbe369dde15bfa549e50f15d20703 | |
| parent | 17553eff091a1b96c4ddd7a118787e8b4d38da5d (diff) | |
| download | perlweeklychallenge-club-3fca1475f6afffcb7cdddaec7dbdc2ea0b521b67.tar.gz perlweeklychallenge-club-3fca1475f6afffcb7cdddaec7dbdc2ea0b521b67.tar.bz2 perlweeklychallenge-club-3fca1475f6afffcb7cdddaec7dbdc2ea0b521b67.zip | |
Add files via upload
| -rw-r--r-- | ch-2.lsp | 15 |
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 |
