Toggle navigation
?
users online
Logout
Open hangout
Open chat for current file
pivot( Bs , As ) :- var(Bs), var(As), !, fail . pivot( Bs , As ) :- var(Bs), !, pivot(As,Bs) . pivot( Bs , As ) :- pivot(Bs,Bs,L-L,As) . pivot( [] , Rs , Ls-[] , Ps ) :- append(Rs,Ls,Ps) . % even length list pivot( [_] , [M|Rs] , Ls-[] , Ps ) :- append(Rs,[M|Ls],Ps) . % odd length list pivot( [_,_|Xs] , [L|Rs] , Ls-[L|Lx] , Ps ) :- pivot(Xs,Rs,Ls-Lx,Ps) . % take 2 and take 1 and recurse down, building the left half as we go