Reverse a list

Kay C Lan lan.kc.macmail at gmail.com
Mon Feb 9 21:10:34 EST 2015


On Tue, Feb 10, 2015 at 8:53 AM, Mike Kerner <MikeKerner at roadrunner.com>
wrote:

> can we come up with a dataset for this test?
>

I personally find scripting a standard dataset the easiest. Here's a script
that will create identical lines, each with 18 x 5 char words. I've just
added  3 lines at the beginning:

aa
bb
cc

and three lines at the end:

xx
yy
zz

otherwise it's impossible to test if the output has actually been sorted
correctly. The output looks like this for non unicode - muliplied however
many time - 10,000 by default:

aa
bb
cc
!"#$% &'()* +,-./ 01234 56789 :;<=> ?@ABC DEFGH IJKLM NOPQR STUVW XYZ[\
]^_`a bcdef ghijk lmnop qrstu vwxyz
!"#$% &'()* +,-./ 01234 56789 :;<=> ?@ABC DEFGH IJKLM NOPQR STUVW XYZ[\
]^_`a bcdef ghijk lmnop qrstu vwxyz
xx
yy
zz

on mouseUp
   ask "How many lines do you want?" with "10000" titled "Number of Lines?"
   put it into tNumLines
   answer "Do you wish to use Unicode?" with "Yes" or "No" titled "Unicode?"

   if (it = "Yes") then
      set the useUnicode to true
      put 5000 into tStart
      put 5089 into tEnd
   else
      put 33 into tStart
      put 122 into tEnd
   end if
   put "aa" & cr & "bb" & cr & "cc" & cr into tDataSet
   put 1 into y
   repeat tNumLines times
      repeat with x = tStart to tEnd
         put numToChar(x) after tDataSet
         if (y = 5) then
            put space after tDataSet
            put 1 into y
         else
            add 1 to y
         end if
      end repeat
      put cr after tDataSet
   end repeat
   put "xx" & cr & "yy" & cr & "zz" after tDataSet
end mouseUp



More information about the use-livecode mailing list