Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #66640] [BUG] minmax operator not working yet

0 views
Skip to first unread message

Richard Hainsworth

unread,
Jun 16, 2009, 1:14:12 PM6/16/09
to bugs-bi...@netlabs.develooper.com
# New Ticket Created by Richard Hainsworth
# Please include the string: [perl #66640]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=66640 >


my @a=1,2,3,4; my @b=9,8,7,1; say (@a minmax @b).perl

yields an error

S03:1621 gives @a minmax @b as an example.

Patrick R. Michaud via RT

unread,
Jun 25, 2009, 3:37:10 PM6/25/09
to perl6-c...@perl.org
On Tue Jun 16 10:14:11 2009, richardh wrote:
> my @a=1,2,3,4; my @b=9,8,7,1; say (@a minmax @b).perl

While rakudo doesn't implement infix:<minmax> yet, the operator is
constrained to having two elements on either side, so the above code
wouldn't work anyway.

It would be good to have some tests for infix:<minmax> -- that should
make it much easier to implement.

Pm

Richard Hainsworth

unread,
Jun 26, 2009, 3:01:23 AM6/26/09
to perl6-bug...@perl.org
I dont quite understand, see below:

Patrick R. Michaud via RT wrote:
> On Tue Jun 16 10:14:11 2009, richardh wrote:
>
>> my @a=1,2,3,4; my @b=9,8,7,1; say (@a minmax @b).perl
>>
>
> While rakudo doesn't implement infix:<minmax> yet, the operator is
> constrained to having two elements on either side, so the above code
> wouldn't work anyway.
>

I took
@a minmax @b
from the Spec.

say (...).perl
formats and prints the return value.

What have I misunderstood?

Patrick R. Michaud

unread,
Jun 27, 2009, 11:12:51 AM6/27/09
to Richard Hainsworth via RT
On Fri, Jun 26, 2009 at 08:37:20AM -0700, Richard Hainsworth via RT wrote:
> >> my @a=1,2,3,4; my @b=9,8,7,1; say (@a minmax @b).perl
> >
> > While rakudo doesn't implement infix:<minmax> yet, the operator is
> > constrained to having two elements on either side, so the above code
> > wouldn't work anyway.
>
> I took
> @a minmax @b
> from the Spec.

Yes, the spec mentions C< @a minmax @b >; it also says that the
result would be (@a[0] min @b[0], @a[1] max @b[1]) . So in
your example above, would you expect the result to be (1, 8) ?

Pm

Richard Hainsworth

unread,
Jun 28, 2009, 10:21:06 AM6/28/09
to perl6-bug...@perl.org
Patrick R. Michaud via RT wrote:
Yes. I was expecting a list of two integers.
Wouldn't .perl.say yield [1,8] ?
Richard

Patrick R. Michaud via RT

unread,
Jun 30, 2009, 12:08:10 PM6/30/09
to perl6-c...@perl.org
The infix:<minmax> operator has now been added in Rakudo a4978b9, with a
test added to t/spec/S03-operator/misc.t in r27322.

Closing ticket,

Pm

0 new messages