Isograms and heterograms: Difference between revisions
Content added Content deleted
(J) |
|||
Line 138: | Line 138: | ||
=={{header|J}}== |
|||
For this task, we want to know the value of n for n-isograms. This value would be zero for words which are not n-isograms. We can implement this by counting how many times each character occurs and determining whether that value is unique. (If it's the unique value, n is the number of times the first character occurs): |
|||
<lang J>isogram=: {{ {. (#~ 1= #@~.) #/.~ y }} S:0</lang> |
|||
Also, it's worth noting that unixdict.txt is already in sorted order, even after coercing its contents to lower case: |
|||
<lang J> (-: /:~) cutLF tolower fread 'unixdict.txt' |
|||
1</lang> |
|||
With this tool and this knowledge, we are ready to tackle this task: |
|||
<lang J> > (/: -@isogram,.-@#@>) (#~ 1<isogram) cutLF tolower fread 'unixdict.txt' |
|||
aaa |
|||
iii |
|||
beriberi |
|||
bilabial |
|||
caucasus |
|||
couscous |
|||
teammate |
|||
appall |
|||
emmett |
|||
hannah |
|||
murmur |
|||
tartar |
|||
testes |
|||
anna |
|||
coco |
|||
dada |
|||
deed |
|||
dodo |
|||
gogo |
|||
isis |
|||
juju |
|||
lulu |
|||
mimi |
|||
noon |
|||
otto |
|||
papa |
|||
peep |
|||
poop |
|||
teet |
|||
tete |
|||
toot |
|||
tutu |
|||
ii |
|||
> (/: -@#@>) (#~ (10<#@>) * 1=isogram) cutLF tolower fread 'unixdict.txt' |
|||
ambidextrous |
|||
bluestocking |
|||
exclusionary |
|||
incomputable |
|||
lexicography |
|||
loudspeaking |
|||
malnourished |
|||
atmospheric |
|||
blameworthy |
|||
centrifugal |
|||
christendom |
|||
consumptive |
|||
countervail |
|||
countryside |
|||
countrywide |
|||
disturbance |
|||
documentary |
|||
earthmoving |
|||
exculpatory |
|||
geophysical |
|||
inscrutable |
|||
misanthrope |
|||
problematic |
|||
selfadjoint |
|||
stenography |
|||
sulfonamide |
|||
switchblade |
|||
switchboard |
|||
switzerland |
|||
thunderclap |
|||
valedictory |
|||
voluntarism </lang> |
|||
=={{header|Julia}}== |
=={{header|Julia}}== |