aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2020-10-05 01:39:31 +0100
committerGitHub <noreply@github.com>2020-10-05 01:39:31 +0100
commit2f3b402ce4ccee68dd46ba26529aea5408422a39 (patch)
tree2d5540192869283ffb4e3fd0158be93c34e3b207
parentb7e2e9b5cfe6277bb15c600376db3d1beaa0b796 (diff)
parentef9ac81609cd0dc26e418fe59bdf7c01899ad3ed (diff)
downloadperlweeklychallenge-club-2f3b402ce4ccee68dd46ba26529aea5408422a39.tar.gz
perlweeklychallenge-club-2f3b402ce4ccee68dd46ba26529aea5408422a39.tar.bz2
perlweeklychallenge-club-2f3b402ce4ccee68dd46ba26529aea5408422a39.zip
Merge pull request #2450 from E7-87-83/master
submit Lisp soln for Task 1
-rw-r--r--challenge-080/cheok-yin-fung/common-lisp/ch-1.lsp14
1 files changed, 14 insertions, 0 deletions
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)))