To delete an element X from a list L, one of the three cases may arise.

  • If X is the only element, then after deleting it, an empty list is returned.
  • If X is head of L, then the Tail part of the list will be returned.
  • If X is an element of the Tail of the list then recursively delete from the tail part.

We need to add the following instructions for the predicate list_delete in the kb5.pl and run the commands as shown in figure.

images
images

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *