Teacup rim text: Difference between revisions
Content deleted Content added
m →{{header|Wren}}: Minor tidy |
Walterpachl (talk | contribs) →{{header|REXX}}: make it ooRexx compliant and READABLE |
||
Line 1,750:
=={{header|REXX}}==
All words that contained
underbars, or embedded blanks)
<br>weren't considered as candidates for circular words.
Line 1,759:
The dictionary wasn't assumed to be sorted in any way.
<syntaxhighlight lang="rexx">
/*REXX pgm finds circular words (length>2), using a dictionary, suppress permutations.*/
parse arg iFID L .
if
word.=0
@.= /*stemmed array of non─duplicated words*/▼
have.=0
do r=0 while lines(iFID)>0
parse upper value linein(iFID) with w . /*obtain a word from the dictionary. */
if length(w)>=3 &,
datatype(w,'U') &,
have.w=0 then
z=word.0+1
word.0=z
cw= 0 /*the number of circular words (so far)*/▼
word.z=w /*Word number z */
say "There're " r ' entries in the dictionary (of all types): ' iFID▼
have.w=1 /*is available */
say "There're " # ' words in the dictionary of at least length ' L▼
end /*r*/ /*dictionary need not be sorted. */
End
say
do j=1 To word.0
w=word.j
lw=length(w)
cl=w
ci=1
do k=1 for lw-1
If have.w Then Do
have.w=0 /*no longer available */
end /*j*/▼
End
Else
Leave
If ci=lw Then Do /*complete list */
say 'circular word: ' cl /*display a circular word and variants.*/
End
End
end /*j*/
say
say cw
{{out|output|text= when using the default inputs:}}
<pre>
There're
There're
circular word:
circular word: ARC,
circular word:
</pre>
|