From ef9ac81609cd0dc26e418fe59bdf7c01899ad3ed Mon Sep 17 00:00:00 2001 From: E7-87-83 Date: Mon, 5 Oct 2020 07:27:14 +0800 Subject: submit Lisp soln for Task 1 --- challenge-080/cheok-yin-fung/common-lisp/ch-1.lsp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 challenge-080/cheok-yin-fung/common-lisp/ch-1.lsp diff --git a/challenge-080/cheok-yin-fung/common-lisp/ch-1.lsp b/challenge-080/cheok-yin-fung/common-lisp/ch-1.lsp new file mode 100644 index 0000000000..905c8b6d4c --- /dev/null +++ b/challenge-080/cheok-yin-fung/common-lisp/ch-1.lsp @@ -0,0 +1,14 @@ +; The Weekly Challenge - Perl & Raku #080 Task 1 Smallest Positive Integer +; Common Lisp script + +(setf arr (list 1 8 -1) ) +(setf *N* (length arr)) +(setf int-seq (list (+ *N* 1))) + +(dotimes (i *N*) + ( push (- *N* i) int-seq) ) ; int-seq == 1, 2, 3, 4, .. N+1 + +(format t "Given a list:" ) +(print arr) +(format t ", the smallest positive integer hasn't appeared:") +(print (nth 0 (set-difference int-seq arr))) -- cgit