Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Anagrams/Zkl/anagrams-1.zkl
Normal file
13
Task/Anagrams/Zkl/anagrams-1.zkl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
File("unixdict.txt").read(*) // dictionary file to blob, copied from web
|
||||
// blob to dictionary: key is word "fuzzed", values are anagram words
|
||||
.pump(Void,T(fcn(w,d){
|
||||
key:=w.split("").sort().concat(); // fuzz word to key
|
||||
d.appendV(key,w); // add or append w
|
||||
},d:=Dictionary(0d60_000)));
|
||||
|
||||
d.filter(fcn([(k,v)]){ v.len()>3 }) // prune to list of # words > 3
|
||||
.sort(fcn([(_,v1)],[(_,v2)]){ v1.len()>v2.len() }) // sort by word count
|
||||
[0,10].pump(Console.println,'wrap([(zz,v)]){ // and print 10 biggest
|
||||
"%d:%s: %s".fmt(v.len(),zz.strip(),
|
||||
v.apply("strip").concat(","))
|
||||
});
|
||||
5
Task/Anagrams/Zkl/anagrams-2.zkl
Normal file
5
Task/Anagrams/Zkl/anagrams-2.zkl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
URL:="http://wiki.puzzlers.org/pub/wordlists/unixdict.txt";
|
||||
var ZC=Import("zklCurl");
|
||||
unixdict:=ZC().get(URL); //--> T(Data,bytes of header, bytes of trailer)
|
||||
unixdict=unixdict[0].del(0,unixdict[1]); // remove HTTP header
|
||||
File("unixdict.txt","w").write(unixdict);
|
||||
Loading…
Add table
Add a link
Reference in a new issue