June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
15
Task/Letter-frequency/Aime/letter-frequency-1.aime
Normal file
15
Task/Letter-frequency/Aime/letter-frequency-1.aime
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
file f;
|
||||
index x;
|
||||
integer c;
|
||||
|
||||
f.affix("unixdict.txt");
|
||||
|
||||
while ((c = f.pick) ^ -1) {
|
||||
x[c] += 1;
|
||||
}
|
||||
|
||||
c = 'A';
|
||||
while (c <= 'Z') {
|
||||
o_form("%c: /w5/\n", c, x[c] += x[c + 'a' - 'A'] += 0);
|
||||
c += 1;
|
||||
}
|
||||
13
Task/Letter-frequency/Aime/letter-frequency-2.aime
Normal file
13
Task/Letter-frequency/Aime/letter-frequency-2.aime
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
file f;
|
||||
index x;
|
||||
integer c, n;
|
||||
|
||||
f.affix("unixdict.txt");
|
||||
|
||||
while ((c = f.pick) ^ -1) {
|
||||
x[c] += 1;
|
||||
}
|
||||
|
||||
for (c, n in x) {
|
||||
o_form("%c: /w5/\n", c, n);
|
||||
}
|
||||
5
Task/Letter-frequency/BaCon/letter-frequency.bacon
Normal file
5
Task/Letter-frequency/BaCon/letter-frequency.bacon
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
txt$ = LOAD$("bible.txt")
|
||||
|
||||
FOR x = 97 TO 122
|
||||
PRINT CHR$(x-32), " ", CHR$(x), " : ", COUNT(txt$, x-32), " - ", COUNT(txt$, x)
|
||||
NEXT
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
function freq(file)
|
||||
h = Dict{Char, Integer}()
|
||||
for x in open(readstring ,file) h[x] = get(h,x,0)+1 end
|
||||
sort(collect(h))
|
||||
using DataStructures
|
||||
|
||||
function letterfreq(file::AbstractString; fltr::Function=(_) -> true)
|
||||
sort(Dict(counter(filter(fltr, readstring(file)))))
|
||||
end
|
||||
|
||||
display(letterfreq("src/Letter_frequency.jl"; fltr=isalpha))
|
||||
|
|
|
|||
|
|
@ -1 +1,9 @@
|
|||
say bag lines».comb
|
||||
.&ws.say for slurp.comb.Bag.sort: -*.value;
|
||||
|
||||
sub ws ($pair) {
|
||||
$pair.key ~~ /\n/
|
||||
?? ('NEW LINE' => $pair.value)
|
||||
!! $pair.key ~~ /\s/
|
||||
?? ($pair.key.uniname => $pair.value)
|
||||
!! $pair
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue