Compare commits
No commits in common. "example_6" and "master" have entirely different histories.
|
@ -1,15 +0,0 @@
|
|||
.dub
|
||||
docs.json
|
||||
__dummy.html
|
||||
docs/
|
||||
/example_6
|
||||
example_6.so
|
||||
example_6.dylib
|
||||
example_6.dll
|
||||
example_6.a
|
||||
example_6.lib
|
||||
example_6-test-*
|
||||
*.exe
|
||||
*.o
|
||||
*.obj
|
||||
*.lst
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"authors": [
|
||||
"alexander"
|
||||
],
|
||||
"description": "Подсчет частот. Лямбда-функции.",
|
||||
"license": "proprietary",
|
||||
"name": "example_6",
|
||||
"targetPath": "bin"
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
import std.stdio, std.string, std.algorithm;
|
||||
|
||||
void main()
|
||||
{
|
||||
// auto f = File("./src/example_6/source/hamlet.txt", "r");
|
||||
auto f = File("./source/hamlet.txt", "r");
|
||||
|
||||
uint[string] freqs;
|
||||
foreach (line; f.byLine)
|
||||
{
|
||||
foreach (word; strip(line).split())
|
||||
{
|
||||
++freqs[word.idup];
|
||||
}
|
||||
}
|
||||
|
||||
string[] words = freqs.keys;
|
||||
sort!((a, b) {
|
||||
return freqs[a] < freqs[b];
|
||||
}) (words);
|
||||
|
||||
foreach (word; words)
|
||||
{
|
||||
writefln("%6u\t%s", freqs[word], word);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue