Task

Create a data structure and the associated methods to define and manipulate a deck of   playing cards.

The deck should contain 52 unique cards.

The methods must include the ability to:

   make a new deck
   shuffle (randomize) the deck
   deal from the deck
   print the current contents of a deck 
Each card must have a pip value and a suit value which constitute the unique value of the card.

Related tasks:

 Card shuffles
 Deal cards_for_FreeCell
 War Card_Game
 Poker hand_analyser
 Go Fish


(import [random [shuffle]])
(setv pips (.split "2 3 4 5 6 7 8 9 10 J Q K A"))
(setv suits (.split "♥ ♦ ♣ ♠"))
(setv cards_per_hand 5)
 
(defn make_deck [pips suits]
    (lfor
        x pips
        y suits
        (+ x y)))
 
(defn deal_hand [num_cards deck]
    (setv delt (cut deck None num_cards))
    (setv new_deck (lfor
                       x deck
                       :if (not (in x delt))
                       x))
    [delt new_deck])
 
 
(if (= __name__ "__main__")
    (do
    (setv deck (make_deck pips suits))
    (shuffle deck)
    (setv [first_hand deck] (deal_hand cards_per_hand deck))
    (setv [second_hand deck] (deal_hand cards_per_hand deck))
    (print "\nThe first hand delt was:" (.join " " (map str first_hand)))
    (print "\nThe second hand delt was:" (.join " " (map str second_hand)))
    (print "\nThe remaining cards in the deck are...\n" (.join " " (map str deck)))))