On Dec 28, 2005, at 10:41 PM, Scott Rossi wrote:

In other words, change "ABCDEF" into "FEDCBA".

I don't know of a clever way to do this off the top of my head, but I do know that this:

  repeat for each char c in x
    put c before y
  end repeat

degrades _really_ badly as the size of x goes up. A 40k string on my 1ghz powerbook takes several seconds.

On the other hand, this:

  repeat with i = 1 to length(x)
    put char -i of x after y
  end repeat

seems to degrade linearly, and a 40k string takes just 9 ticks.

This also degrades linearly, but takes five times as long as the above solution:

  put 0 into i
  repeat for each char c in x
    add 1 to i
    put c into z[i]
  end repeat
  repeat with i = i down to 1
    put z[i] after y
  end repeat

regards,

Geoff
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to