On Tue, Feb 24, 2009 at 1:39 PM, Daniel Ruoso <dan...@ruoso.com> wrote:
> Em Ter, 2009-02-24 às 13:34 -0800, Jon Lang escreveu:
>> Daniel Ruoso wrote:
>> >  if $y ~~ [..] $x ± $epsilon {...}
>> Junctions should not return individual values in list context,
> It is not the junction that is returning the individual values, but the
> infix:<±> operator...

Hmm... true point.  Thinking through it some more, I'm reminded of an
early proposal to do something similar with square roots in
particular, and with non-integer exponents in general.  e.g., "sqrt(4)
=== ±2".  IIRC, the decision was made that such a capability would
work best as part of an advanced math-oriented module, and that things
should be arranged such that sqrt($x).[0] in that advanced module
would be equivalent to sqrt($x) in Perl's default setting.  That would
mean that sqrt(4) would have to produce (+2, -2) in list context,
rather than (-2, +2) - which, in turn, would mean that ±2 should do
likewise.  And however prefix:<±> works, infix:<±> should follow suit,
returning addition first and subtraction second.

Which would further mean that you should use the reversal metaoperator as well:

  if $y ~~ [R..] $x ± $epsilon {...}

Jonathan "Dataweaver" Lang

Reply via email to