I understand the prologue, trying to implement the removal of the first and last element from the list. The first one is deleted, but I don’t understand how to change the code so that the last one is deleted.
domains i=integer list=i* predicates del(i,list,list) clauses del(1,[_|T],T):-!. del(N,[_,Y|T],L):-N1=N-1,del(N1,[Y|T],L). goal del(1,[2,5,6,-5,7,8,11,16,23,4],L).