Prime words: Difference between revisions

Content added Content deleted
Line 516: Line 516:
A suitable implementation of `is_prime` is given at
A suitable implementation of `is_prime` is given at
[[Erd%C5%91s-primes#jq]] and is therefore not repeated here.
[[Erd%C5%91s-primes#jq]] and is therefore not repeated here.
<lang jq>def is_prime_word: all(explode[]; is_prime);


The task description suggests that perhaps the appropriate
definition of `is_prime_word` should focus on the alphabetic characters,
perhaps along the lines of:
<lang jq>def is_prime_word: all(gsub("[^A-Za-z]";"") | explode[]; is_prime);
</lang>
All such variations are as easy to accommodate as to envision, but for unixdict.txt the following suffices:
<lang jq>def is_prime_word: all(explode[]; is_prime);</lang>
<lang jq>
inputs | select(is_prime_word)</lang>
inputs | select(is_prime_word)</lang>
{{out}}
{{out}}
Line 559: Line 566:
q
q
</pre>
</pre>



=={{header|Julia}}==
=={{header|Julia}}==