RU beehive logo ITEC dept promo banner
ITEC 380
2015fall
ibarland

homelecturesrecipeexamshwsD2Lbreeze (snow day; distance)

lect38-prolog-lists
lists in prolog


1that is, inverse-ancestors      

2 Calling . (cons) is one of the few (non-boolean) functions we have in prolog:

.(hi, .(bye, .(done, [])))

% same as:
[hi, bye, done]
In practice, we only use the square-bracket syntax (along with |).      

3 Note that, according to rule ii, we would have phrased mem_v1(Target,Itms) :- Itms=[], fail. as mem_v1(Target,[]) :- fail. to start with, if we'd written it down at all.      

4 Actually, the term Var=Pattern gets re-written as Pattern=Pattern, which simplifies to the term true, which can be elided from the right-hand-side (since that right-hand-side is a list-of-anded-terms).      

homelecturesrecipeexamshwsD2Lbreeze (snow day; distance)


©2015, Ian Barland, Radford University
Last modified 2015.Dec.27 (Sun)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.