CPSC 3520 - DAY 7 FEBRUARY 1, 2018 ================================================================================ 2 clauses a->a a:-a. a. Lists in Prolog --------------- Lists in Prolog consist of elements seperated by commas and enclosed in bracket [], i.e., [a,b,c,d] is a 4-element list of the elements a through d. Lists may be used as arguments to predicates. A list is a single argument to a predicate, regardless of the length of the list. Lists may be comprised of variables, constants and other lists. Elementary list manipulation is based upon notation for the head(X) and tail(Y) of a list. These are denoted in Prolog statements as: [X | Y] [X | Y] [1,2,3,4] 1, [2,3,4] List Membership Example ----------------------- X is a member of a list if it is the head (the first element) of the list or it is a member of the tail (the rest) of the list. ! - cut Prolog provides the not predicate. Provides the opposite of the goal.