From 0801107ed8666794d35b3cb23f72bdfdad6d0120 Mon Sep 17 00:00:00 2001 From: Fung Cheok Yin <61836418+E7-87-83@users.noreply.github.com> Date: Sun, 26 Jul 2020 18:22:44 +0800 Subject: Update and rename ch-2.lsp to challenge-070/cheok-yin-fung/common-lisp/ch-2.lsp --- ch-2.lsp | 15 --------------- challenge-070/cheok-yin-fung/common-lisp/ch-2.lsp | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 ch-2.lsp create mode 100644 challenge-070/cheok-yin-fung/common-lisp/ch-2.lsp diff --git a/ch-2.lsp b/ch-2.lsp deleted file mode 100644 index 8cce700264..0000000000 --- a/ch-2.lsp +++ /dev/null @@ -1,15 +0,0 @@ -(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 diff --git a/challenge-070/cheok-yin-fung/common-lisp/ch-2.lsp b/challenge-070/cheok-yin-fung/common-lisp/ch-2.lsp new file mode 100644 index 0000000000..34828f265f --- /dev/null +++ b/challenge-070/cheok-yin-fung/common-lisp/ch-2.lsp @@ -0,0 +1,17 @@ +;; Perl Weekly Challenge 070 Task 2 Gray Code Sequence + +(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 -- cgit