aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--model.lisp12
-rw-r--r--packages.lisp3
2 files changed, 14 insertions, 1 deletions
diff --git a/model.lisp b/model.lisp
index a93cf6e..068844b 100644
--- a/model.lisp
+++ b/model.lisp
@@ -76,3 +76,15 @@
(->> (suit->int suit)
(* 13)
(+ (rank->int rank)))))
+
+(fn suit< (s1 s2) (-> (suit suit) boolean)
+ (< (suit->int s1) (suit->int s2)))
+
+(fn rank< (r1 r2) (-> (rank rank) boolean)
+ (< (rank->int r1) (rank->int r2)))
+
+(fn card< (c1 c2) (-> (card card) boolean)
+ (destructuring-bind ((r1 . s1) (r2 . s2)) (list c1 c2)
+ (if (eq r1 r2)
+ (suit< s1 s2)
+ (rank< r1 r2))))
diff --git a/packages.lisp b/packages.lisp
index 386abe1..14b4706 100644
--- a/packages.lisp
+++ b/packages.lisp
@@ -40,7 +40,8 @@
;; Converters
:int->suit :int->rank :int->card
:suit->int :rank->int :card->int
- ))
+ ;; Comparators
+ :suit< :rank< :card<))
(defpackage cantedraw.main
(:use :cl :cantedraw.lib.macros :cantedraw.lib.functions)