next up previous index
Next: Graphs Up: Functions Previous: Pipelined Function Application   Index

Subsections

Q Primitives within Functions

In order to access stream data from within a sequential function implementation, several primitive operations are supplied. The simplest of these primitive operations (curr) takes a stream fragment pointer and provides a pointer to the value of the ``current'' stream element in an input or output stream. These primitive operations all operate exclusively using the information provided to a function in the stream fragments describing its input and output stream parameters.

Intensional Data Access

Unlike the streams traditionally used in programming, which only support access to one stream element, a Q function may access the set of stream elements described by its stream access pattern. In order to select particular elements within this set, several primitive operators are provided.

The next intensional operator, which references data advanced one step from the current position along a specified dimension, is supported within sequential functions. A more general form, rel, equivalent to multiple serial applications of the next operator, and a prev operator, which references data one step earlier along a dimension, are also provided.


Context Query

A context query operator (context or #) is supported for use within sequential functions. The absolute context (or position) along a specified dimension is returned. The dimension must be one of the function's bound dimensions.


Direct Addressing

A direct addressing operator (at or @) is used to index an arbitrary element of a stream along a specified dimension. In its elemental form, it provides stream programming with data dependent data access -- any data access may be to any element of the source stream. It is available within a sequential function in a limited form: a function must bound the application of the operator, communicating the bounds to the control machine in its predefined stream access patterns.


next up previous index
Next: Graphs Up: Functions Previous: Pipelined Function Application   Index
magiceight-web@media.mit.edu