Ordered words: Difference between revisions
Content added Content deleted
(Frink) |
m (→{{header|J}}: url for unixdict.txt had changed, and it's probably more polite to use a locally cached copy) |
||
Line 2,429: | Line 2,429: | ||
=={{header|J}}== |
=={{header|J}}== |
||
<lang j>NB. from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt |
|||
<lang j> require'web/gethttp' |
|||
oWords=: (#~ ] = /:~L:0) cutLF CR-.~fread 'unixdict.txt' |
|||
;:inv (#~ (= >./)@:(#@>)) oWords |
|||
;:inv (#~ (= >./)@:(#@>))oWords |
|||
abbott accent accept access accost almost bellow billow biopsy chilly choosy choppy effort floppy glossy knotty</lang> |
abbott accent accept access accost almost bellow billow biopsy chilly choosy choppy effort floppy glossy knotty</lang> |
||
Recap: |
Recap: |
||
# |
# read dictionary (<code>CR-.~fread 'unixdict.txt'</code>) |
||
# break into words, one per line (<code> |
# break into words, one per line (<code>cutLF</code>) |
||
# find ordered words (<code> |
# find ordered words (<code>(#~ ] = /:~L:0)</code>) |
||
# select the longest ordered words (<code>(#~ (= >./)@:(#@>))oWords</code>) |
# select the longest ordered words (<code>(#~ (= >./)@:(#@>))oWords</code>) |
||
# format for display (using ;:inv) |
# format for display (using ;:inv) |