7 lines
161 B
Prolog
7 lines
161 B
Prolog
|
|
equilibrium_index(List, Index) :-
|
||
|
|
append(Front, [_|Back], List),
|
||
|
|
sumlist(Front, Sum),
|
||
|
|
sumlist(Back, Sum),
|
||
|
|
length(Front, Len),
|
||
|
|
Index is Len.
|