Prime words: Difference between revisions

Added Uiua solution
(Initial FutureBasic task solution added)
(Added Uiua solution)
 
(3 intermediate revisions by 2 users not shown)
Line 950:
meg
q</pre>
 
=={{header|MiniScript}}==
This implementation is for use with the [http://miniscript.org/MiniMicro 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}}==
Line 1,666 ⟶ 1,690:
meg
q
</pre>
 
=={{header|Uiua}}==
{{works with|Uiua|0.11.0-dev.1}}
<syntaxhighlight lang="Uiua">
⊜□ ≠@\n. &fras "unixdict.txt"
Ps ← ⇌◌⍢(▽≠0◿⊢..⟜(⊂⊢)|>0⧻.):[]+2⇡256 # Build primes
Pc ← ▽:⟜(∊-@\0)⊂¯.+@a⇡26Ps # Test A-Za-z for primal ASCII codes
▽:⟜(≡(/×◇∊)⊙¤):Pc
</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>
 
Line 1,671 ⟶ 1,708:
{{libheader|Wren-math}}
{{libheader|Wren-iterate}}
<syntaxhighlight lang="ecmascriptwren">import "io" for File
import "./math" for Int
import "./iterate" for Stepped
 
// cache prime characters with codepoints between 33 and 255 say
67

edits