Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -4,8 +4,8 @@ void main() {
bool[string] seenWords;
size_t pairCount = 0;
foreach (word; readText("unixdict.txt").toLower().splitter()) {
auto drow = word.dup.reverse;
foreach (const word; readText("unixdict.txt").toLower.splitter) {
const drow = word.dup.reverse; // Deprecated.
if (drow in seenWords) {
if (pairCount++ < 5)
writeln(word, " ", drow);

View file

@ -0,0 +1,9 @@
void main() {
import std.stdio, std.file, std.algorithm, std.string, std.range;
auto words = "unixdict.txt".readText.split.zip(0.repeat).assocArray;
auto pairs = zip(words.byKey, words.byKey.map!(w => w.dup.reverse))
.filter!(wr => wr[0] < wr[1] && wr[1] in words)
.zip(0.repeat).assocArray;
writeln(pairs.length, "\n", pairs.byKey.take(5));
}

View file

@ -0,0 +1,7 @@
(let Semordnilap
(mapcon
'((Lst)
(when (member (reverse (car Lst)) (cdr Lst))
(cons (pack (car Lst))) ) )
(make (in "unixdict.txt" (while (line) (link @)))) )
(println (length Semordnilap) (head 5 Semordnilap)) )