I apologize in advance for posting yet another "suggestion" without having 
full knowledge of all apocalypses, and I fear (for a very positive 
meaning of "fear") that the answer will be: "but that is already 
available".

Well, the point is that I wonder wether Perl6 will support cartesian 
products between lists, i.e. an infix operator that will return a list of 
arrayrefs "containing" ordered pairs from the originating lists.

Now, one possible difficulty with such an operator would be wrt what to do 
with applying it twice or even more times. One would reasonably want it to 
be associative in the obvious sense, but this won't happen (because 
mathematically speaking (AxA)xA and Ax(AxA) are associative "only" up to 
a *natural* isomorphism, which doesn't make much difference, 
mathematically speaking, but indeed it does in a computer programming 
context).

However I already know that I'll be told that I can cook up something like 
that myself. But to be fair I think that the context in which such a beast 
would be most useful would be that of iterating over multiple variables, 
so one (well, I for one!) could be content with a special syntax for that, 
instead.

Put more clearly, it is now common to see things like:

  for my $x (1..10) {
      for my $y (5..20) {
          for my $text (qw/foo bar baz/) {
              do_stgh_with $x, $y, $text;
          }
      }
  }

and it would be very much in the phylosophy of Perl to allow for a very 
concise syntax to obtain the same effect. I am aware of the zip operator, 
but AFAICT it solves an equally common but completely different problem...


Michele
-- 
The amount of repetition repetition isn't that great. 
- Ignacy Sawicki in comp.text.tex
  thread "Bug in FeynMF's Queues?"

Reply via email to