[Aldor-l] empty Generator?

W Naylor wn at cs.bath.ac.uk
Thu Feb 15 07:34:11 EST 2007


Hi Ralf,

unfortunatly I'm a bit out of context to answer your Feb 6th question :-(
However for your grnerator one, the algebra library exports a partialNext!
function which allows to detect if g is empty:

%14 >> g: Generator Integer := generate yield 123;
  () @ Generator(AldorInteger)
                                           Comp: 0 msec, Interp: 610 msec
%15 >> stdout<<partialNext! g
[F 123]  () @ TextWriter
                                           Comp: 0 msec, Interp: 200 msec
%16 >> stdout<<partialNext! g
[T]  () @ TextWriter
                                           Comp: 10 msec, Interp: 10 msec
%17 >> stdout<<partialNext! g
[T]  () @ TextWriter

all the best,

Bill

On Thu, 15 Feb 2007, Ralf Hemmecke wrote:

> Unfortunately, nobody from the Aldor developers has answered my question.
> 
> http://www.aldor.org/pipermail/aldor-l/2007-February/000583.html
> 
> Does that mean there are no Aldor developers??? :-(
> 
> In the hope there is still somebody listening...
> 
> Given g: Generator(Integer). Is it possible to check whether g is empty, 
> i.e. whether it will generate *no* element? However, I don't want such a 
> function
> 
>    empty?: Generator Integer -> Boolean
> 
> to modify g. So
> 
> g: Generator Integer := generate yield 123;
> b: Boolean empty? g;
> l: List Integer := [g];
> 
> should give
> 
> b=false and l=[123].
> 
> Ralf
> _______________________________________________
> Aldor-l mailing list
> Aldor-l at aldor.org
> http://www.aldor.org/mailman/listinfo/aldor-l
> 
> 
> 



More information about the Aldor-l mailing list