root/tags/lgt2308/library/numberlistp.lgt

Revision 3567, 0.7 KB (checked in by pmoura, 21 months ago)

Added predicate product/2.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- protocol(numberlistp).
3
4    :- info([
5        version is 1.1,
6        author is 'Paulo Moura',
7        date is 2007/4/20,
8        comment is 'List of numbers protocol.']).
9
10    :- public(product/2).
11    :- mode(product(+list(number), ?number), zero_or_one).
12    :- info(product/2,
13        [comment is 'Calculates the product of all list values.',
14         argnames is ['List', 'Product']]).
15
16    :- public(sum/2).
17    :- mode(sum(+list(number), ?number), zero_or_one).
18    :- info(sum/2,
19        [comment is 'Calculates the sum of all list values.',
20         argnames is ['List', 'Sum']]).
21
22    :- public(average/2).
23    :- mode(average(+list(number), ?float), zero_or_one).
24    :- info(average/2,
25        [comment is 'Calculates the average of a list  of values.',
26         argnames is ['List', 'Average']]).
27
28:- end_protocol.
Note: See TracBrowser for help on using the browser.