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:
@@ -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))))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user