Prolog Query Question (DCG)

Associate
Joined
13 Jan 2007
Posts
2,424
Location
Belfast,Northern Ireland
Have a prolog assignment which I've done but this particular one is confusing me a bit.

question_2b(N,Rest):- phrase(determiner(N),[these,lonely,roads,reach,the,silent,village], Rest).

The response given is no. This is because 'these' isn't defined in the lexicon as a determiner.

Now if I remove everything from the list that isn't correctly defined. The response is still no, despite 'the' which is correctly defined as a determiner being further down the list. If I put a valid determiner as the first word in the list, the reponse is yes. Highlighting the and then producing the remainder of the list for Rest.

I have queried an advisor at a scheduled session and he tried to explain this to me but I still don't really get it. Its something to do with only returning the head of a list? Why does this only work if there is a valid determiner as the first item? After it finds the first item, why doesn't it continue through the list to find other determiners?

In other similar questions prolog churns out alternate answers and all sorts though using sentence instead of determiner.

Thanks for any help
 
Back
Top Bottom