-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrc-oeis
executable file
·45 lines (35 loc) · 1.17 KB
/
rc-oeis
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env perl6
## display OEIS citations
# 2022-03-02 2023-02-02
# cross-check via OEIS module?
#`{
Example of how to annotate RC page with 'see also' links:
; See also
;* [[wp:Safe_and_Sophie_Germain_primes|Wikipedia: Sophie Germain primes]]
;* [[oeis:A005384|OEIS:A005384 - Sophie Germain primes]]
;* [[Safe_primes_and_unsafe_primes|Related Task: Safe_primes_and_unsafe_primes]]
}
my @code;
my @dirs.push: .IO.absolute.IO for flat '0'..'Z';
while @dirs {
my @files = @dirs.pop;
next unless @files[0].IO.e;
while @files {
for @files.pop.dir -> $path {
next if $path.f and $path ~~ rx{ '.jvm' };
next if $path.f and $path ~~ rx{ '.' \d };
push @code: $path if $path.f;
push @dirs: $path if $path.d and $path.r;
}
}
}
for @code.sort -> $f {
my $fn = IO::Spec::Unix.splitpath($f)[*-1];
next unless my @oeis = $f.IO.slurp.lines.grep: { $_ ~~ /^^ '#n# OEIS:' / };
say "{ $fn ~~ /^ 'OEIS'/ ?? '2' !! $fn.substr(0,1)}/$fn";
say @oeis».subst('#n# OEIS:', '').join("\n"); say '';
}
=finish
use OEIS;
dd OEIS::lookup(280498);
# https://modules.raku.org/dist/OEIS:cpan:TOBS/t/02-attributes.t