|
|||||
Functions: uses | |||||
Prerequisite Concepts | Related Syntax |
One principle that might help programmers understand what's allowed in functions is that function definitions are essentially rules. Functions differ from rules in that the programmer specifies when functions are performed and what arguments are passed to them by specifying a function call, whereas, in general, the input data determines where rules are performed and what information (pattern variables and attribute values) is passed to them.
Apart from that, however, rules and function definitions are the same sort of thing. Furthermore, whatever can be done in a rule that calls a function can also be done in a function. For example, a function can use the %c
operator, or the "%v", or "%q" format items when called from a rule that supports them. The most useful application of this feature is the ability to write a function that does generic processing on a class of element types, possibly supporting some parameterization by the arguments passed to the function.
Prerequisite Concepts Functions |
Related Syntax define function |
---- |