Commit 19b4453b authored by HEMERY Mathieu's avatar HEMERY Mathieu
Browse files

Modify add_list so that it works for float too

parent a4423b01
......@@ -167,9 +167,14 @@ list(List) :-
%! add_list(+List1,+List2,-ListSum)
%
% Add two lists term at term
% (Note that using maplist(plus(...)) work only for integers
add_list([Head1|Tail1], [Head2|Tail2], [Head12|Tail12]) :-
Head12 is Head1 + Head2,
add_list(Tail1, Tail2, Tail12).
add_list([], [], []).
add_list(L1, L2, L12) :-
maplist(plus, L1, L2, L12).
%! multiply_list(+List, +A, -Alist)
%
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment