Advanced Language Features

This notebook introduces advanced language features in RAW, which are useful for structuring more complex RQL programs.


Declarations are used to organize RQL expressions.

Given the query:

... we can instead structure it using declarations as follows:

The queries are equivalent in terms of execution.

Each declaration can be bound to any RAW expression/query.


Functions are similar to declarations, but take arguments as input:

Functions can have default arguments and can be overridden.

Anonymous functions

Anonymous functions, or functions without names, can also be defined.

These use the syntax:

\(<list of arguments>) -> <body>

For instance:

Of course defining an anonymous function then binding it to the name f isn't very useful.

Instead, we could have done:

However, anonymous functions have a useful feature: they can be the final expression on a virtual view, which effectively makes this into a parameterized view:

We can ask the type of this view:

The view types as a function. So to use it, we can "call it":

Next: Packages