RFC: naming for FrontTransversal and Transversal ranges

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Apr 29 08:19:56 PDT 2009


Hello,


I'm defining two ranges that go vertically over a range of ranges. 
Consider for example an int[][]. That's a range that has a range as its 
element type.

FrontTransversal goes transversally over the range of ranges and returns 
the front of each element in turn:

     int[][] x = new int[][2];
     x[0] = [1, 2];
     x[1] = [3, 4];
     auto ror = frontTransversal(x);
     auto witness = [ 1, 3 ];
     uint i;
     foreach (e; ror) assert(e == witness[i++]);
     assert(i == 2);

Then Transversal does a similar thing, just that instead of going 
through the front of each range, it goes over a column set during 
construction:

     int[][] x = new int[][2];
     x[0] = [1, 2];
     x[1] = [3, 4];
     auto ror = transversal(x, 1);
     auto witness = [ 2, 4 ];
     uint i;
     foreach (e; ror) assert(e == witness[i++]);
     assert(i == 2);

Question is, what would be two good names for these ranges?


Andrei



More information about the Digitalmars-d mailing list