Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
34
Task/Semordnilap/SNOBOL4/semordnilap.sno
Normal file
34
Task/Semordnilap/SNOBOL4/semordnilap.sno
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
* Program: semordnilap.sbl
|
||||
* To run: sbl semordnilap.sbl < unixdict.txt
|
||||
* Description: A semordnilap is a word (or phrase) that spells
|
||||
* a different word (or phrase) backward. "Semordnilap"
|
||||
* is a word that itself is a semordnilap.
|
||||
* Example: lager and regal
|
||||
* Reads file unixdict.txt
|
||||
* Comment: Tested using the Spitbol for Linux version of SNOBOL4
|
||||
|
||||
output = "Some Semordnilap Pairs from File unixdict.txt"
|
||||
atable = table(25200,,-1)
|
||||
ntable = table(25200,,-2)
|
||||
|
||||
* Read dictionary file into memory
|
||||
in1
|
||||
word = input :f(p1)
|
||||
count = count + 1
|
||||
atable[word] = word
|
||||
ntable[count] = word
|
||||
:(in1)
|
||||
|
||||
* Process dictionary to find unique semordnilaps
|
||||
p1
|
||||
i = lt(i,count) i + 1 :f(p2)
|
||||
newword = atable[reverse(ntable[i])]
|
||||
leq(newword,-1) :s(p1)
|
||||
ident(ntable[i],newword) :s(p1)
|
||||
output = lt(outcount,5) ntable[i] ', ' newword
|
||||
atable[ntable[i]] = atable[newword] = -1
|
||||
outcount = outcount + 1
|
||||
:(p1)
|
||||
p2
|
||||
output = 'The number of semordnilap pairs is: ' outcount
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue