June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View 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;
}

View 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);
}

View 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

View file

@ -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))

View file

@ -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
}