Odd words: Difference between revisions

Content added Content deleted
m (→‎version 2, caseless: used more idiomatic code.)
m (→‎version 2, caseless: added a comment.)
Line 720: Line 720:
minW= minL * 2 - 1 /*minimum width of a word to be usable.*/
minW= minL * 2 - 1 /*minimum width of a word to be usable.*/
say copies('─', 30) # "words in the dictionary file: " iFID
say copies('─', 30) # "words in the dictionary file: " iFID
say
ows= 0 /*count of the "odd words" found. */
finds= 0 /*count of the "odd words" found. */
do j=1 for #; L= length($.j) /*process all the words that were found*/
do j=1 for #; L= length($.j) /*process all the words that were found*/
if L<minW then iterate /*Is word too short? Then ignore it. */
if L<minW then iterate /*Is word too short? Then ignore it. */
Line 729: Line 730:
owU= ow; upper owU /*uppercase the odd word to be caseless*/
owU= ow; upper owU /*uppercase the odd word to be caseless*/
if @.owU=='' then iterate /*if not extant, then skip this word. */
if @.owU=='' then iterate /*if not extant, then skip this word. */
ows= ows + 1 /*bump the count of "odd words" found. */
finds= finds + 1 /*bump the count of "odd words" found. */
say right(left($.j, 20), 24) left(ow, 9) /*indent original word for readability.*/
say right(left($.j, 20), 24) left(ow, 9) /*indent original word for readability.*/
end /*j*/
end /*j*/
/*stick a fork in it, we're all done. */
say copies('─', 30) ows ' "odd words" found with a minimum length of ' minL</lang>
say copies('─', 30) finds ' "odd words" found with a minimum length of ' minL</lang>
{{out|output|text=&nbsp; when using the default input:}}
{{out|output|text=&nbsp; when using the default input:}}
<pre>
<pre>