:- module(_, [prefix_sum/2], [assertions,regtypes,nativeprops, predefres(res_steps), rtchecks_shallow
	]).

:- entry prefix_sum/2:list(num)*var.
:- pred prefix_sum(A,B):(listnum(A),var(B)) => (listnum(B)).
prefix_sum([],[]).
prefix_sum(X,Y):-
	D=0,
	prefix_sum_(D,X,Y).

:- pred prefix_sum_(A,B,C):(num(A), listnum(B), var(C)) => (listnum(C)).
prefix_sum_(_,[],[]).
prefix_sum_(N,[X|Y],[X1|LL]):-
	X1 is N + X,
	prefix_sum_(X1,Y,LL).