Shift operation is used to shift one element of a list to the left rotationally. For example, given a list [a,b,c,d], then after shifting, it will be [b,c,d,a]. To implement shifting operation in Prolog, copy the following rule in kb5.pl and execute the instructions as given below. The clause list_shift(L1, L2) takes an input list in the form [Head|Tail] and then recursively concatenates Head after the Tail.

images

images


Comments

Leave a Reply

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