We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 95cc309 + a933e5a commit 165e633Copy full SHA for 165e633
rosalind/itwv-grondilu.pl
@@ -0,0 +1,31 @@
1
+# Solution for http://rosalind.info/problems/itwv/
2
+#
3
+# THIS IS WAY TOO SLOW!!
4
5
+use v6;
6
+my $dna = 'GACCACGGTT';
7
+my @motif = <ACAG GT CCG>;
8
+
9
+sub interwove($a, $b) {
10
+ gather if none($a, $b) eq '' {
11
+ for &?ROUTINE($a.substr(1), $b) {
12
+ take $a.substr(0,1) ~ $_
13
+ }
14
+ for &?ROUTINE($a, $b.substr(1)) {
15
+ take $b.substr(0,1) ~ $_
16
17
18
+ elsif $a eq '' { take $b }
19
+ else { take $a }
20
+}
21
22
+my %seen;
23
+for @motif -> $a {
24
+ say gather for @motif -> $b {
25
+ my @interwove = interwove($a, $b).uniq;
26
+ take %seen{sort($a, $b).join(':')} //=
27
+ +so grep rx/ <@interwove> /, $dna;
28
29
30
31
+# vim: ft=perl6
0 commit comments