Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: LordKinbote
  • Order by date
  1. LordKinbote

    Adding numbers in a List?

    Try using an accumulator to keep track of the sum so far. add(Lst,Sum) :- add(Lst,Sum,0). add([],Sum,Sum). add([X|Xs],Sum,Acc) :- NewAcc is Sum+Acc, add(Xs,Sum,NewAcc). I haven't tested it, but this should do the trick. The add/2 rule sets the accumulating helper to...

Part and Inventory Search

Back
Top