Ordered words: Difference between revisions

Content added Content deleted
m (→‎{{header|J}}: unixdict.txt uses unix format -- no carriage returns)
Line 2,430: Line 2,430:
=={{header|J}}==
=={{header|J}}==
<lang j>NB. from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt
<lang j>NB. from http://wiki.puzzlers.org/pub/wordlists/unixdict.txt
oWords=: (#~ ] = /:~L:0) cutLF CR-.~fread 'unixdict.txt'
oWords=: (#~ ] = /:~L:0) cutLF 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>
Line 2,436: Line 2,436:
Recap:
Recap:


# read dictionary, discarding irrelevant carriage return characters (<code>CR-.~fread 'unixdict.txt'</code>)
# read dictionary (<code>fread 'unixdict.txt'</code>)
# break into words, one per line (<code>cutLF</code>)
# break into words, one per line (<code>cutLF</code>)
# find ordered words (<code>(#~ ] = /:~L:0)</code>)
# find ordered words (<code>(#~ ] = /:~L:0)</code>)