Subject: Prolog examples

From: Ada Winters <[email-masked]>
Date: Mon, 27 Mar 2000 21:22:21 -0600

Dear Sirs,
I need help with the following programs:
1.  Write a predicate dislay_list with arity 1 to display an entire list
w/o any user prompts where each list element appears on a spearate line
with its sequence number and it works for the empty list.

2.  Write a predicate tohead with arity 3 that will move an element to the
head of a list:
tohead( c, [a, b, c, d], X ).
X = [c, a, b, d]
tohead (c, [x, y, z], X ).
no

3.  Write a Prolog predicate has_no_intersection of arity 2 that succeeds
if the set intersection of two given list parameters is empty.

4.  Write a Prolog predicate that will find the route from one location to
another.  
intersect( smith, duncan ).
intersect( nashville, asheville ).
intersect( asheville, moses ).
route ( smith, moses, X )
X = [ smith, asheville, moses ]
route( smith, smith, X ).
X = [ smith ]
route( moses, smith, X )
no

Please help immediately.
Thanks.
Ada