can anyone see what this function does?
An example of a way to test it is,Code:take(X,Xs,Ys) :- append(As,[X|Bs],Xs),append(As,Bs,Ys). append([],Xs,Xs). append([X|Xs],Ys,[X|Zs]) :- append(Xs,Ys,Zs).
take(b,[a,b,b],L).
which gives..
L = [a, b]
L = [a, b]
But im not sure quite whats going on, any ideas anyone?![]()


Reply With Quote