aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)))