add sum_list/3

This commit is contained in:
Vitor Santos Costa 2008-11-03 16:00:22 +00:00
parent 259313b603
commit 8938666bf5
2 changed files with 10 additions and 0 deletions

View File

@ -8716,6 +8716,12 @@ Holds when @code{append(_,Suffix,List)} holds.
@cnindex sum_list/2
True when @var{Numbers} is a list of numbers, and @var{Total} is their sum.
@item sum_list(?@var{Numbers}, +@var{SoFar}, ?@var{Total})
@findex sum_list/3
@syindex sum_list/3
@cnindex sum_list/3
True when @var{Numbers} is a list of numbers, and @var{Total} is the sum of their total plus @var{SoFar}.
@item sumlist(?@var{Numbers}, ?@var{Total})
@findex sumlist/2
@syindex sumlist/2

View File

@ -29,6 +29,7 @@
sublist/2,
substitute/4,
sum_list/2,
sum_list/3,
suffix/2,
sumlist/2,
list_concat/2,
@ -316,6 +317,9 @@ suffix(Suffix, [_|List]) :-
sumlist(Numbers, Total) :-
sumlist(Numbers, 0, Total).
sum_list(Numbers, SoFar, Total) :-
sumlist(Numbers, SoFar, Total).
sum_list(Numbers, Total) :-
sumlist(Numbers, 0, Total).