Luke Palmer wrote:

The remaining problem is what to do about unary dot.  Repeated here for
the, er, benefit? of p6l:

    class Duple {
        has $.left;
        has $.right;

        method perform (&oper) {
            &oper($.left);
            &oper($.right);
        }
    }

Let's change that into a Tuple class:

    class Tuple {
        has @.elems;

        method perform (&oper) {
            for @.elems {
                .perform($_);
            }
        }
    }

Can you find the mistake?

Well it's not using &oper on the elems anymore.

        method perform (&oper) {
          for @.elems {
            &oper($_);
          }
        }

But I don't think that was the mistake you were talking about. And I don't see what it has to do with unary dot either, because you don't need to use unary dot to implement that method. Unless each member of @.elems is a Duple, in which case the class isn't one I'd call Tuple.

Sorry, nitpicking level seems to be set to 9 at the moment. What did you mean?

Reply via email to