Skip to main content
deleted 265 characters in body
Source Link
null
  • 12.2k
  • 3
  • 58
  • 93

Perl 6

Perl 6 makes easy things easy and the hard things possible. Making 2 + 2 equal 5 is an easy thing. You just need to redefine + infix to specially treat those integers. This also works with code like (1 + 1) + (1 + 1)I have no idea why it happens. And, 2 + 4 is still 6, so it's not that old meaning of + has disappearedHelp.

multi infix:<+>(2, 2) { 5 }
say 2 + 2;

Perl 6

Perl 6 makes easy things easy and the hard things possible. Making 2 + 2 equal 5 is an easy thing. You just need to redefine + infix to specially treat those integers. This also works with code like (1 + 1) + (1 + 1). And, 2 + 4 is still 6, so it's not that old meaning of + has disappeared.

multi infix:<+>(2, 2) { 5 }
say 2 + 2;

Perl 6

I have no idea why it happens. Help.

multi infix:<+>(2, 2) { 5 }
say 2 + 2;
Source Link
null
  • 12.2k
  • 3
  • 58
  • 93

Perl 6

Perl 6 makes easy things easy and the hard things possible. Making 2 + 2 equal 5 is an easy thing. You just need to redefine + infix to specially treat those integers. This also works with code like (1 + 1) + (1 + 1). And, 2 + 4 is still 6, so it's not that old meaning of + has disappeared.

multi infix:<+>(2, 2) { 5 }
say 2 + 2;