Nathan Torkington wrote:
> Jeremy Howard writes:
> > No, there's no arbitrary decision. *Every* operator is component wise on
> > lists. It is internally consistent, and consistent with most other
languages
> > that provide array/list operators. It's easy to get stuck on the '*'
> > example, because different mathematicians have different feelings about
what
> > matrix operation should map to '*'. However, there is no consistant and
> > meaningful definition of array operations (for _all_ operators) other
than
> > that defined in RFC 82.
> >
> Actually, the only refinement I'd like to see is that boolean operators
> (==, &&, ||) be excepted from the distributive rule.
>
> This is to permit:
>
>   if (@a == @b) # shallow comparison

Already works under the RFC (scalar context).
>
> and
>
>   @a = @b || @c; # @a=@b or @a=@c; # ish
>
Doesn't work in P5 (try it!)

> The math operations are fine to apply to each element.  I have no
> problem with those being distributive, but I think || for default
> values and == for comparison are too ingrained and they'd be too
> useful (as opposed to a distributive || or &&, which is much less
> useful).
>
== is applied in a scalar context--fine. || as you show it can not be
ingrained because it doesn't currently work this way!


Reply via email to