![]() ![]() The concatenation(連接) relation: conc( L1, L2, 元) here L1 and L2 are two lists, and 元 is their concatenation.X is a member of L if either: (1) X is the head of L, or (2) X is a member of the tail of L.For example: member( b, ) is true member( b, ]) is not true member(, ]) is true.The goal member( X, L) is true if X occurs in L.The membership relation: member( X, L) where X is an object and L is list.Adding a new object to a list, or deleting some object form it.Concatenation(連接) of two lists, obtaining a third list, which may correspond to the union of sets.Checking whether some object is an element of a list, which corresponds to checking for the set membership.The most common operations on lists are:.List are handled in Prolog as a special case of binary trees.A list is a data structure that is either empty or consists of two parts: a headand a tail.X = a Y = b yes 3.1 Representation of list Hobbies1 = Hobbies2 = L = ,tom,] yes | ?- L=. The head and the tail are then combined into a structure by a special functor.the head can be anything (for example: a tree or a variable).The remaining part of the list, called the tail.The first term, called the head of the list. ![]() A list is a sequence of any number of items.Part 1 The Prolog LanguageChapter 3 Lists, Operators, Arithmetic ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |