Skip to content

2) Types and Variables

Julien Cumin edited this page Apr 29, 2016 · 18 revisions

#Types and Variables

##Variables

Any uppercase latin letter is a variable identifier, initially not unified to anything. There is thus 26 available variable names. These variables and their possible values are not shared between rules.

Variable can be unified by using them as inputs or outputs to predicates or by direcly unifying them with other variables. For example, IJ will unify I with J (or fail if they cannot be unified).

##Lists

Lists are noted in between square brackets [...] and elements of a list are separated using :. One can also construct a list using :. For example, :2:3. will unify the Output with the list [Input:2:3]. However, 2:3 will not unify the Input with the list [2:3] ; it will instead unify the Input with 2 and then construct the list [2:3] ([2:3] would have unified the Input with [2:3]).

##Strings

Strings are opened and closed with double quotes "...". \ will escape the following character.

##Integers and Floats

Integers and floats are written using the numbers 0 to 9 as expected. The decimal separator is .. A floating point number must have at least one digit before and after the decimal separator.