Commit 5d3f1e1d authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

Move multiply_list/3 in util.pl

parent 56e5dbc1
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
util, util,
[ [
add_list/3, add_list/3,
multiply_list/3,
name_variables_and_anonymous/2, name_variables_and_anonymous/2,
camel_case/2, camel_case/2,
set_to_list/2, set_to_list/2,
...@@ -170,6 +171,16 @@ add_list([Head1|Tail1],[Head2|Tail2],[HeadSum|TailSum]) :- ...@@ -170,6 +171,16 @@ add_list([Head1|Tail1],[Head2|Tail2],[HeadSum|TailSum]) :-
HeadSum is Head1 + Head2, HeadSum is Head1 + Head2,
add_list(Tail1,Tail2,TailSum). add_list(Tail1,Tail2,TailSum).
%! multiply_list(+List, +A, -Alist)
%
% Alist = A x List
multiply_list([], _, []).
multiply_list([Head| Tail], A, [AHead| ATail]) :-
AHead is A*Head,
multiply_list(Tail, A, ATail).
nth0_eqq(0, [Head | _Tail], Result) :- nth0_eqq(0, [Head | _Tail], Result) :-
Head == Result. Head == Result.
......
Supports Markdown
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