Dave Whipp wrote:

> Jon Lang wrote:
>> So you're suggesting that
>>  A op* n
>> should map to
>>  [op] A xx n
> I don't think that that mapping works for Thomas' proposal of a repetition
> count on post-increment operator. I.e.
>  $a ++* 3
> is not the same as
>  [++] $a xx 3
> (which I think is a syntax error)

It is.

> Also, he's suggesting getting rid of the "xx" operator, and replacing it
> with ",*" -- I'm sure I could get used to that

Currently, it's being assumed that the repetition meta-operator will be
appended to the operator, followed by the repetition count:

  $value op* $count

This makes it difficult to apply the replication meta-operator to a prefix
operator.  However, a second option could be provided, where the
meta-operator gets prepended:

  $count *op $value


  5 *, $n === $n ,* 5 === $n, $n, $n, $n, $n
  $n ++* 5 === (((($n++)++)++)++)++
  5 *++ $n === ++(++(++(++(++$n))))

And obviously the metaoperator is nonsensical when applied to a binary
operator with different types of values on its left and right sides.

As with other meta-operators, it should be possible to explicitly define a
symbol that would otherwise be interpreted as a meta'd operator, because of
efficiency; because the operator in question has capabilities above and
beyond what the meta-operator would indicate; or because the operator in
question doesn't bear any resemblance to the replicated use of a shorter
operator.  In particular, ** would be overloaded in this manner: to make
reasonable sense, the count of a repetition meta-operator must be an
unsigned integer of some sort, whereas exponents can be any type of number.
Heck, they don't even have to be real.

Jonathan "Dataweaver" Lang

Reply via email to