Make card a structure

Card is a structure instead of just a type.  Stronger type checking,
automatic constructor, destructors and existence check.
This commit is contained in:
2025-02-22 23:00:17 +00:00
parent 62f92114ee
commit a80b64b045
2 changed files with 38 additions and 36 deletions

View File

@@ -40,16 +40,18 @@
(:use :cl :5d-lib.macros :5d-lib.functions)
(:export
;; Types
:int-card :rank :suit :card :cardset
:int-card :rank :suit :cardset
;; card struct
:card :make-card :card-suit :card-rank :card-p
;; Converters
:int->suit :int->rank :int->card
:suit->int :rank->int :card->int
;; Comparators
:suit< :rank< :card<
;; Serialisers
:suit->str :rank->str :card->str :cardset->str
:suit->str :rank->str :cardset->str
;; Constructors
:make-joker :make-deck))
:make-deck))
(defpackage cantedraw.player
(:nicknames :5d.player)