Can you please explain Why Matching Variable Is Important In Prolog? What Is The Method To Match Variables?

DWQA QuestionsCategory: PrologCan you please explain Why Matching Variable Is Important In Prolog? What Is The Method To Match Variables?
Editor Staff asked 9 months ago

Can you please explain Why Matching Variable Is Important In Prolog? What Is The Method To Match Variables?

1 Answers
Editor Staff answered 9 months ago

In Prolog, in order to process the elements of a list, we have to match them to variables. The method for doing is
We get the head by matching it to a variable.
By calling a predicate with the variable, it processes the head.
Until you get an empty list repeat the above steps.