-
-
Save colomon/8540035 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
proto fringe($) { gather { {*} } } | |
multi fringe (Pair $node) { take fringe $_ for $node.kv } | |
multi fringe (Any $leaf) { take $leaf } | |
sub samefringe ($a, $b) { fringe($a) eqv fringe($b) } | |
my $a = 1 => 2 => 3 => 4 => 5 => 6 => 7 => 8; | |
my $b = 1 => (( 2 => 3 ) => (4 => (5 => ((6 => 7) => 8)))); | |
my $c = (((1 => 2) => 3) => 4) => 5 => 6 => 7 => 8; | |
my $x = 1 => 2 => 3 => 4 => 5 => 6 => 7 => 8 => 9; | |
my $y = 0 => 2 => 3 => 4 => 5 => 6 => 7 => 8; | |
my $z = 1 => 2 => (4 => 3) => 5 => 6 => 7 => 8; | |
use Test; | |
plan 6; | |
ok samefringe $a, $a; | |
ok samefringe $a, $b; | |
ok samefringe $a, $c; | |
nok samefringe $a, $x; | |
nok samefringe $a, $y; | |
nok samefringe $a, $z; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment