Prime words: Difference between revisions
Content added Content deleted
(Initial FutureBasic task solution added) |
imported>Chinhouse No edit summary |
||
Line 950: | Line 950: | ||
meg |
meg |
||
q</pre> |
q</pre> |
||
=={{header|MiniScript}}== |
|||
This implementation is for use with the Mini Micro version of MiniScript. The command-line version does not include a HTTP library. Modify the declaration of wordList object to use the file class to read a local copy of the word list file. |
|||
<syntaxhighlight lang="miniscript"> |
|||
isPrimeWord = function(word) |
|||
if word.len == 0 then return false |
|||
for ch in word.split("") |
|||
if "aegkmq".indexOf(ch) == null then return false |
|||
end for |
|||
return true |
|||
end function |
|||
wordList = http.get("http://wiki.puzzlers.org/pub/wordlists/unixdict.txt").split(char(10)) |
|||
primes = [] |
|||
for word in wordList |
|||
if isPrimeWord(word) then primes.push(word) |
|||
end for |
|||
print primes.join(", ") |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
a, aaa, age, agee, ak, am, ama, e, egg, eke, em, emma, g, ga, gag, gage, gam, game, gamma, ge, gee, gem, gemma, gm, k, keg, m, ma, mae, magma, make, mamma, me, meek, meg, q |
|||
</pre> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |