Anadromes: Difference between revisions
m
→{{header|AppleScript}}: Nicer logic in the second repeat.
(Realize in F#) |
m (→{{header|AppleScript}}: Nicer logic in the second repeat.) |
||
Line 159:
set wordArray to (wordArray's filteredArrayUsingPredicate:(filter))
-- Derive a list of the reversed remaining words. This is what takes most of the time.
script o
property wordList : wordArray as list
Line 166:
set AppleScript's text item delimiters to ""
repeat with i from 1 to (count o's wordList)
set
end repeat
Line 177:
set o's wordList to (wordSet's allObjects()'s sortedArrayUsingSelector:("localizedStandardCompare:")) as list
-- Construct the output line by line, omitting palindromes and already matched word pairs
set output to {}
repeat with
set
set o's wordList's item i to missing value
if (reversedWord is in o's wordList) then set output's end to thisWord & " <--> " & reversedWord
end repeat
set AppleScript's text item delimiters to linefeed
|