The following Lucid operators are currently unsupported by the Q instruction set architecture:
The ``as soon as'' operator, asa, returns the ``first'' data value along the specified dimension for which the control value is non-zero. Note that it returns a constant. The value returned is the same in all contexts, once the control value is non-zero in the ``first'' (in an implementation-dependent manner) value. Here is a theoretical recursive Lucid implementation:
data asa.d control = if control then data; else next.d data asa.d next.d ctl fi;
The asa operator has largely been replaced in Q by support for positive and negative infinity in the range of a select task.
The ``wherever'' operator, wvr, returns a stream of data values selected by an associated non-zero control value. An intensional implementation using the @ operator is defined below. In it, t1 is a stream containing the location of the next selected value, and t2 is a stream containing a single entry for each selected value.
data wvr.d ctl = data @.d t2 where t1 = if ctl then #.d; else next.d t1 fi; t2 = t1 fby.d t1 @.d t2 + 1; end;
A limited form of the wvr operator is provided by the Q select task, where range is a vector of parameters defining a stream subset along a particular dimension:
select.d( data, range ) = data wvr.d is_contained( #.d, range ); select.d,e,f( data, range_d, range_e, range_f ) = ((data wvr.d is_contained( #.d, range_d )) wvr.e is_contained( #.e, range_e )) wvr.f is_contained( #.f, range_f );
The ``advanced upon'' operator, upon, returns a stream of data values selected by an associated non-zero control value. The input/output rate is unbounded...
Here is an implementation using the @ operator:
data upon.d ctl = data @.d t1 where t1 = 0 fby.d if ctl then t1 + 1; else t1 fi; end;
It should be possible to implement both upon and wvr operators as C functions, which operate within bounds...