A calculator Query can call any query or calculator in any scope, including it's own. It has format:
[ template name (terms) ] << [scope.]query ( [ arguments ] );
The most distinguishing trait of a calculator query is the << operator, which is like the query chain operator, but pointing in the opposite direction.
The next thing which stands out is there is a template on the left hand side of the query operator. This is referred to as an "inner" template and it's terms are unified with the query solution and then evaluated to allow the solution to be shaped to the caller's requirements. However, the inner template is optional as it is possible to populate a list passed as an argument to return a query result (see SortCities for example).
The format on the right hand side of the << operator is also interesting for two reasons:
- The query name can be 1-part or, if the query is be performed in the context of another scope, 2-part. Note it is possible to call a global scope query to be executed in another scope.
- The optional query arguments can be named or anonymous eg.
country="US"versus"US". Anonymous terms are matched by position to the leading terms of the target template. This allows the caller freedom to not name arguments if there is no need.
