scanl(:Goal,
+List, +V0, -Values)<= m <=
4) lists of length n head-to-tail ("scan-left"), using columns of m
list elements as arguments for Goal. The scanl
family of predicates is defined as follows, with V0 an
initial value and V the final value of the scanning
operation:
scanl(G, [X_11, ..., X_1n],
[X_21, ..., X_2n],
...,
[X_m1, ..., X_mn], V0, [V0, V1, ..., Vn] ) :-
call(G, X_11, ..., X_m1, V0, V1),
call(G, X_12, ..., X_m2, V1, V2),
...
call(G, X_1n, ..., X_mn, V<n-1>, Vn).
scanl behaves like a foldl that collects
the sequence of values taken on by the Vx accumulator into a
list.