The following section describes three basic Lucid operators: stream initialization, context query and indexing, along with their Q equivalents.
The Lucid ``followed-by'' (fby) operator is replaced with two different mechanisms. In the case that the first parameter (the ``first'' value) is a constant, the basic stream definition suffices, with the second parameter specified as the source of the stream. If the first parameter contains a variable (stream), an mcond statement must be used.
The Lucid context query operator (#) is supported for use within Q functions. Currently there is no Q DFG equivalent to #, although it may be used in mcond conditional statements.
The Lucid direct addressing operator, @, is used to index a particular subset of a stream, along a specified dimension. It is available within a Q function in a limited form, see section 3.3.3. It is not directly supported at the Q DFG level, except in the form of special cases such as resample.
The Lucid next intensional operator, which references data one step further along a specified dimension, is supported for use within Q functions. A more general form, rel, equivalent to multiple serial applications of the next operator, is also provided.
Q operators available within functions may be defined in terms of the Lucid # and @ primitives as follows:
next.d x = x @.d (#.d + 1); prev.d x = x @.d (#.d - 1); rel.d( x, n) = x @.d (#.d + n);
The Lucid first operator always returns the first value (or subspace) along the specified dimension. As such, it isn't really intensional! It is not supported within Q functions.
All of these primitives (first, next, rel, and prev) may be used in Q DFGs. They are obtained as special cases of the resample task.