Refactor Joker generation in make-deck to use mapcar on a range.

This new version is terser while still expressing what I want.
This commit is contained in:
2025-02-14 17:44:46 +00:00
parent 955e921f80
commit fba391a6e8

View File

@@ -124,11 +124,8 @@
(fn make-deck (&optional (n 1)) (-> (&optional fixnum) cardset) (fn make-deck (&optional (n 1)) (-> (&optional fixnum) cardset)
(append (append
(loop :for i :from 1 :to n (loop :for _ :from 1 :to n
:nconc (loop :for j :from 1 :to 52 :nconc (loop :for j :from 1 :to 52
collect (int->card (1- j)))) collect (int->card (1- j))))
(loop :for i :from 1 :to n (mapcar ($ int->rank make-joker)
:collect (->> i (range 0 (* 2 n)))))
1-
int->rank
make-joker))))