Prime words: Difference between revisions

Content added Content deleted
(Added solution for Action!)
(Added 11l)
Line 23: Line 23:


<br><br>
<br><br>
=={{header|11l}}==
<lang 11l>F is_prime(Int a)
I a == 2
R 1B
I a < 2 | a % 2 == 0
R 0B
L(i) (3 .. Int(sqrt(a))).step(2)
I a % i == 0
R 0B
R 1B

Set[Int] prime_chars
L(c) ‘a’.code .. ‘z’.code
I is_prime(c)
prime_chars.add(c)
L(c) ‘A’.code .. ‘Z’.code
I is_prime(c)
prime_chars.add(c)

L(word) File(‘unixdict.txt’).read().split("\n")
L(c) word
I c.code !C prime_chars
L.break
L.was_no_break
print(word)</lang>

{{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|Action!}}==
=={{header|Action!}}==
In the following solution the input file is loaded from H6 drive. Altirra emulator automatically converts CR/LF character from ASCII into 155 character in ATASCII charset used by Atari 8-bit computer when one from H6-H10 hard drive under DOS 2.5 is used.
In the following solution the input file is loaded from H6 drive. Altirra emulator automatically converts CR/LF character from ASCII into 155 character in ATASCII charset used by Atari 8-bit computer when one from H6-H10 hard drive under DOS 2.5 is used.