domains
list=integer*
predicates
shift(list,list)
del(list,list)
add(list,list,list)
clauses
shift(L1,L2):-
del(L1,L3),
add(L3,L1,L2).
del([Head|Tail],Tail).
add([],[Head|Tail],[Head]).
add([Head|Tail],L1,[Head|L2]):-
add(Tail,L1,L2).
OUT PUT
=======
Goal: shift([1,2,3,4,5],List)
List=[2,3,4,5,1]
1 Solution
-------------------------------------
Goal: shift([1,2,3,4,5,6,7,8,9],List)
List=[2,3,4,5,6,7,8,9,1]
1 Solution