Article View: comp.lang.prolog
Article #2449British coinage problem
From: Thom Fruehwirth
Date: Thu, 07 Jan 1993 14:13
Date: Thu, 07 Jan 1993 14:13
21 lines
883 bytes
883 bytes
min_coins(Value,Coins):- list(Coins),sum_coins(Coins,Value).
list([]).
list([X|L]):- list(L).
sum_coins([],0).
sum_coins([Coin|Coins],Sum):-
coin(Coin,Value),
Value =< Sum,
NewSum is Sum-Value,
sum_coins(Coins,NewSum).
coin('ten shilling note', 120).
coin( 'half-crown', 30).
coin( 'florin', 24).
coin( 'shilling', 12).
coin( 'sixpence', 6).
coin( 'threepenny bit', 3).
coin( 'penny', 1).
% thom
Technical Details
Message-ID:
<1993Jan7.141322.22240@ecrc.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!ecrc!acrab60!thomShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.prolog Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!ecrc!acrab60!thom From: thom@ecrc.de (Thom Fruehwirth) Subject: British coinage problem Message-ID: <1993Jan7.141322.22240@ecrc.de> Keywords: Keep simple problems simple Sender: news@ecrc.de Reply-To: thom@ecrc.de Organization: European Computer-Industry Research Centre GmbH. Date: Thu, 7 Jan 1993 14:13:22 GMT Lines: 22