Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Prolog
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Data types === Prolog's single [[data type]] is the ''term''. Terms are either ''[[symbol (programming)#Prolog|atom]]s'', ''numbers'', ''variables'' or ''compound terms''.<ref group=note> The Prolog terminology differs from that of [[First-order logic|logic]]. A term of Prolog is (depending on the context) a [[Term (logic)|term]] or an [[atomic formula]] of logic. An atom in a standard logic terminology means an [[atomic formula]]; an atom of Prolog (depending on the context) is a constant, function symbol or predicate symbol of logic. </ref> * An '''atom''' is a symbol name starting with a lower case letter or guarded by quotes. Examples of atoms include <code>x</code>, <code>red</code>, <code>'Taco'</code>, <code>'some atom'</code>, and <code>'p(a)'</code>. * '''Numbers''' can be [[floating-point arithmetic|floats]] or [[integer]]s. Most of the major Prolog systems support arbitrary length integer numbers. * '''Variables''' are denoted by a string consisting of letters, numbers and underscore characters, and beginning with an upper-case letter or underscore. Variables closely resemble variables in logic in that they are placeholders for arbitrary terms. * A '''compound term''' is composed of an atom called a "functor" and a number of "arguments", which are again terms. Compound terms are ordinarily written as a functor followed by a comma-separated list of argument terms, which is contained in parentheses. The number of arguments is called the term's [[arity]]. An atom can be regarded as a compound term with [[arity]] zero. An example of a compound term is <code>person_friends(zelda,[tom,jim])</code>. Special cases of compound terms: * A ''List'' is an ordered collection of terms. It is denoted by square brackets with the terms separated by commas, or in the case of the empty list, by <code>[]</code>. For example, <code>[1,2,3,4]</code> or <code>[red,green,blue]</code>. * ''Strings'': A sequence of characters surrounded by quotes is equivalent to either a list of (numeric) character codes, a list of characters (atoms of length 1), or an atom depending on the value of the Prolog flag <code>double_quotes</code>. For example, <code>"to be, or not to be"</code>.<ref name="ISO 13211-1 6.3.7">ISO/IEC 13211-1:1995 Prolog, 6.3.7 Terms - double quoted list notation. [[International Organization for Standardization]], Geneva.</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Prolog
(section)
Add topic