Kaz Kylheku
3/24/2015 1:15:00 AM
On 2015-03-23, WJ <w_a_x_man@yahoo.com> wrote:
> Concision is power
W00T? None to be seen in this mindless gobbledygook.
> Gauche Scheme:
>
> (use srfi-42) ; do-ec
>
> (let1 table (make-hash-table 'string=?)
> (call-with-input-file "WORD_LST.txt"
> (lambda (port)
> (do-ec (: word port read-line)
> (hash-table-push! table (sort word) word))))
> (for-each
> (lambda (words) (print (sort (cdr words))))
> (take
> (sort-by (hash-table->alist table) (.$ - length))
> 22)))
TXR Lisp:
(let* ((lines (get-lines (open-file "/usr/share/dict/words")))
(groups (group-by [chain copy sort] lines :equal-based)))
[mapdo [iff cdr prinl] [sort (hash-values groups) > length]])
Output:
("carets" "caster" "caters" "crates" "reacts" "recast" "traces")
("pares" "parse" "pears" "rapes" "reaps" "spare" "spear")
("drapes" "padres" "parsed" "rasped" "spared" "spread")
[ snip ]
("part" "rapt" "tarp" "trap")
[ snip ]
("fifties" "iffiest")
("citric" "critic")
("incised" "indices")
("griffin" "riffing")
("dishing" "shindig")
("girding" "ridging")
("bribing" "ribbing")
("Chaitin" "Chianti")
("ignite" "tieing")
("dailies" "liaised")
("infidel" "infield")
("gilding" "gliding")
("kiwi" "wiki")
("cognition's" "incognito's")