Monday, 31 October 2016

Write a Prolog program to remove the Nth item from a list.

% Write a Prolog program to remove the Nth item from a list.

/*delete a number in the list. */
delte(1,[_|T],T).
delte(P,[X|Y],[X|R]):-
 P1 is P-1,
 delte(P1,Y,R).

% Output
Prolog program to remove the Nth item from a list
                        Prolog program to remove the Nth item from a list

No comments:

Post a Comment