CSE505/A/append.P
2024-02-19 23:38:00 -05:00

16 lines
342 B
OpenEdge ABL

append([],Ys,Ys).
append([X|Xs],Ys,[X|Zs]) :- append(Xs,Ys,Zs).
suffix(Xs, Ys) :-
append(Xs, Suffix, Ys),
write(Suffix).
cut(Zs) :-
findall([Xs,Ys], (append(Xs, Ys, Zs)), Results),
print_results(Results).
print_results([]).
print_results([Result|Results]) :-
write(Result), nl,
print_results(Results).