Determine the sum of all numbers in a list (first parameter), the sum is unified with the second parameter.
This predicate is located in the file 'list.txt', use ensure_loaded/1 to include this file.
see also: conc/3 del/3 largest_number/2 last/2 lengthlist/2 member/2 prefix/2 reverse/2 smallest_number/2 sublist/2 suffix/2 sum_list_integer/2
| Example | |
| sum_list([], S). | succeeds and the variable S is unified with the value 0 S=0 |
| sum_list([1, 2.4, 3], S). | succeeds and S is unified with the value 6.4 S=6.4 |
| sum_list([1, 2], 3.1). | fails because 3 is the sum of the list and that value cannot be unified with the value 3.1 |