Given a stream of Point instances, you can filter out those
that have an x coordinate of at least 100 as follows:
Point* ps = new{new Point(1,2), new Point(100,200)};
Point* xs = ps[it.x >= 100]; // xs == [new Point(100,200)]
Point* xs = ps[x >= 100]; // allowed abbreviation
Normal scope rules apply, so in the example below the filter predicate always
returns false, and you need to write the unabbreviated form ps[it.x >=100]
to disambiguate:
int x = 13; int* xs = ps[x > 100]; // xs = [];
Inside the filter predicate applied to a stream of type T*
(or any other stream type) you can use the variable position
of type int which indicates the index of it
in the stream and it of type T,
which is bound to the current item in the context stream.
int* xs = new{0,3,2,4,5,8,2,2,1};
int* ys = xs[it > position ]; // xs = [3,4,5,8]