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)
|
||||
(append
|
||||
(loop :for i :from 1 :to n
|
||||
(loop :for _ :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))))
|
||||
(mapcar ($ int->rank make-joker)
|
||||
(range 0 (* 2 n)))))
|
||||
|
||||
Reference in New Issue
Block a user