Jump to content

Compound data type: Difference between revisions

Added Prolog
(Added Prolog)
Line 1,566:
6
</pre>
 
=={{header|Prolog}}==
Prolog terms ARE compound data types, there is no need to specifically define a type.
for the purpose of this exercise you could define a rule like so:
<lang prolog>point(10, 20).</lang>
This will create static point that can be called:
<lang prolog>?- point(X,Y).
X = 10,
Y = 20.</lang>
terms can be passed around as values and can have a complex nested structure of any size, eg:
<lang prolog>person_location(person(name(N), age(A)), point(X, Y)).</lang>
 
=={{header|PureBasic}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.