-
-
Save anonymous/c6d54c302f4c4a63c21b to your computer and use it in GitHub Desktop.
xkcd 1537
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Xkcd::Types { | |
multi sub infix:<+>(Int $n, Str $m) { ($n + $m.Int).Str } | |
multi sub infix:<+>(Str $n, @a where !@a) { "[$n]" } | |
multi sub infix:</>(Int $n, 0) is export { NaN } | |
multi sub infix:<+>(NaN, Int $n) { class NaP {}; } | |
multi sub infix:<+>("", "") { '"+"' } | |
multi sub infix:<+>(Array $a, Int $n) is export { so none(|$a) == $n } | |
}; | |
import Xkcd::Types; | |
.perl.say for ( 2 + "2", "2" + [], (2/0), (2/0) + 2, ""+"", [1,2,3] + 2, [1,2,3] + 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment