This type defines all places where the occurrence of the respective symbol will be valid in the program. So the complete pattern-declaration instruction looks as follows:







declare_pattern name ≔ syntax ⇒ type ➞ meaning;







> An example: the following pattern declaration defines both the syntax and the semantics of integer-potentiation symbols like, for instance, "174^3" or "2^19". All constructs used here for defining the meaning of that pattern are predefined in π and can for now be interpreted in an intuitive way (see below; %W- suppresses the occurrence of whitespaces):







declare_pattern

integer_potentiation ≔

integer:i %W- "^" %W- integer:j

⇒ integer ➞

{

int result = i;

for (int k = 1; k <= j-1; k++)

result *= i;

return result;

};







> After the declaration of that pattern, its applications can be immediately used at any place where an integer symbol may occur, e.g., in an instruction like "print(174^3);".







> We will see later that the pattern-declaration instruction and any other of the predefined instructions of π, the so called "core-pattern-set", are patterns themselves; they are, for instance, instruction patterns like the pattern-declaration instruction, the print instruction and the for-loop or data patterns like the integer pattern or the pattern pattern – and yes, a pattern is a pattern itself, its syntax is as follows:







name "≔" syntax "⇒" type "➞" meaning







> Thus, the actual pattern-declaration instruction has the following syntax, i.e., it takes a pattern as a parameter:







"declare_pattern" pattern ";"







> The following little code-fragment is a complete π-program consisting of two pattern-declaration instructions and two other (predefined) instructions, "print" and "if", immediately making use of the just defined symbols (the operators ">" and "? :" are predefined patterns, too):







(1) declare_pattern maximum ≔

"max" "(" integer:a "," integer:b ")"

⇒ integer ➞ ( a > b ) ? a : b;



(2) print( max (13^2, 101) );



(3) declare_pattern absolute_value ≔

"|" integer:i "|" ⇒ integer ➞

( i ≥ 0 ) ? i : -i;



(4) if ( max (13^2, |-171|) > 169 )

print ("yes!");







> After the first pattern-declaration (line 1), the interpreter would know the pattern "maximum". Therefore the second instruction (line 2) is correctly interpreted. After the second pattern-declaration (line 3), the interpreter knows both the user-defined patterns "maximum" and "absolute-value" and can correctly interpret the last instruction-symbol (line 4) which is making use of both of them.