aboutsummaryrefslogtreecommitdiff
path: root/challenge-092
diff options
context:
space:
mode:
authordrbaggy <js5@sanger.ac.uk>2020-12-22 10:33:27 +0000
committerdrbaggy <js5@sanger.ac.uk>2020-12-22 10:33:27 +0000
commit18715b2d7b5df3abcc0a144a4795b78459f556ce (patch)
tree03a9f67b04e00e5af8e159f2190e06507a095886 /challenge-092
parent05130909e425e47598905389b597a601c2638085 (diff)
downloadperlweeklychallenge-club-18715b2d7b5df3abcc0a144a4795b78459f556ce.tar.gz
perlweeklychallenge-club-18715b2d7b5df3abcc0a144a4795b78459f556ce.tar.bz2
perlweeklychallenge-club-18715b2d7b5df3abcc0a144a4795b78459f556ce.zip
added a version of the call without comments as the comments make it harder to view the "beauty" of the method
Diffstat (limited to 'challenge-092')
-rw-r--r--challenge-092/james-smith/perl/ch-1.pl7
1 files changed, 6 insertions, 1 deletions
diff --git a/challenge-092/james-smith/perl/ch-1.pl b/challenge-092/james-smith/perl/ch-1.pl
index 7b6ce67bb0..43a1d4c5e3 100644
--- a/challenge-092/james-smith/perl/ch-1.pl
+++ b/challenge-092/james-smith/perl/ch-1.pl
@@ -31,6 +31,11 @@ sub iso {
map { $m{$_}||=$x++ } ## Return letter from cache (or next letter)
split m{}, $_ ## Split into individual characters
} @_;
- return $a eq $b ? 1 : 0; ## Check to see if generated words are isomorphic
+ return $a eq $b || 0; ## Check to see if generated words are isomorphic
+}
+
+sub iso_without_comments {
+ my ($a,$b) = map { my ($x,%m)='a'; join '', map { $m{$_}||=$x++ } split m{}, $_ } @_;
+ return $a eq $b || 0;
}