Playing cards: Difference between revisions

Updated to work for Go Fish
(→‎{{header|Python}}: Add another example that uses Poker hand analyser#Python,)
(Updated to work for Go Fish)
Line 1,035:
=={{header|Erlang}}==
The -spec() is a type declaration. It is optional, but helps humans to understand complex data types and the Erlang type verifier (dialyzer) to check the code.
 
This module is used by [[Go_Fish]].
<lang Erlang>
-module( playing_cards ).
 
-export( [deal/2, deal/3, deck/0, print/1, shuffle/1, sort_pips/1, sort_suites/1, task/0] ).
 
-record( card, {pip, suite} ).
Line 1,052 ⟶ 1,054:
 
shuffle( Deck ) -> knuth_shuffle:list( Deck ).
 
sort_pips( Cards ) -> lists:keysort( #card.pip, Cards ).
 
sort_suites( Cards ) -> lists:keysort( #card.suite, Cards ).
 
task() ->
Anonymous user