Αποτελέσματα Αναζήτησης
25 Μαΐ 2010 · Tuple term construction with the ,/2 operator is generally right-associative in PROLOG (typically referred to as a sequence), so your input of a, b(c), d(e(f)), g might well actually be the term (a, (b(c), (d(e(f)), g))).
Example. The PROLOG clause /*1*/ member(X,[X|_]). is an example of a fact concerning the relation with the name member. This relation concerns the objects X and [X|_] (their meaning will be discussed shortly). The clause is preceded by a comment; in PROLOG, comments have to be speci ed between the delimiters /*and */. 3
These lecture notes introduce the declarative programming language Prolog. The em-phasis is on learning how to program, rather than on the theory of logic programming. Nevertheless, a short chapter on the logic foundations of Prolog is included as well.
Prolog is sent into action by giving it a goal, which we can think of for the moment just as a simple command. Simple Prolog commands are formed by a name (the predicate name), followed by brackets round the data item(s) involved (the arguments). The Prolog command for simple printing is write. Try
Repetition and Structures in Prolog. 1 Repetition. Most of the examples so far have been pretty simple, and we have carefully avoided programs that employ any sort of repetition. Here we properly introduce repetition. While many languages use loops for repetition, these are intentionally absent in Prolog.
Programming in Prolog: using the ISO standard/W.F. Clocksin, C.S. Mellish.--5th ed. p.cm. Includes bibliographical references and index. ISBN 978-3-540-00678-7 (alk.paper)
A Prolog program consists of a le containing a set of facts and (optionally) a set of rules. 1.2.1 Facts. Semantically the facts constitute a declaration of a true state of a airs. As far as Prolog is concerned, any fact in its database is treated as true. If a le containing the fact. male(phil). is consulted, the goal.