Monday, 26 May 2014

Prolog Program to extract Head and Tail Part of the List

Prolog Program to extract Head and Tail Part of the List.

Program:

domains
list = symbol*

predicates
head_tail(list,symbol.list)

clauses
head_tail([H|T),H,T).

goal with output

goal: head_tail([a,b,c,d],X,Y)
output: X=a, Y=["b","c","d"]
           1 solution

No comments:

Post a Comment