[M3devel] iterating over sets?

Henning Thielemann lemming at henning-thielemann.de
Wed Oct 31 23:09:11 CET 2007


On Wed, 31 Oct 2007, Jay wrote:

> Let's say I had
>
> TYPE T = SET OF { 0 .. 256 };
>
> Must I say:
>
> VAR t: T;
> FOR i := FIRST(t) TO LAST(t)
>   IF i IN t DO
>    something with i
>   END
> END

You may speed up search by splitting the set into subsets.

E.g.

 IF t * T{16..31} = T{} THEN
   skip this block completely
 ELSE
   inspect that block in detail
 END;



More information about the M3devel mailing list