aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--model.lisp14
-rw-r--r--packages.lisp4
2 files changed, 17 insertions, 1 deletions
diff --git a/model.lisp b/model.lisp
index d17d130..ccbaa9a 100644
--- a/model.lisp
+++ b/model.lisp
@@ -118,3 +118,17 @@
(->> cardset
(mapcar #'card->str)
(format nil "~{~a~^, ~}")))
+
+(fn make-joker (&optional (rank :ACE)) (-> (&optional rank) card)
+ (cons rank :Joker))
+
+(fn make-deck (&optional (n 1)) (-> (&optional fixnum) cardset)
+ (append
+ (loop :for i :from 1 :to n
+ :nconc (loop :for j :from 1 :to 52
+ collect (int->card (1- j))))
+ (loop :for i :from 1 :to n
+ :collect (->> i
+ 1-
+ int->rank
+ make-joker))))
diff --git a/packages.lisp b/packages.lisp
index 3ea9ba7..28fd51b 100644
--- a/packages.lisp
+++ b/packages.lisp
@@ -43,7 +43,9 @@
;; Comparators
:suit< :rank< :card<
;; Serialisers
- :suit->str :rank->str :card->str :cardset->str))
+ :suit->str :rank->str :card->str :cardset->str
+ ;; Constructors
+ :make-joker :make-deck))
(defpackage cantedraw.main
(:use :cl :cantedraw.lib.macros :cantedraw.lib.functions)