RunArray improvement request
tim Rowledge
tim at rowledge.org
Wed Nov 23 02:20:45 UTC 2005
There's a number of places where a RunArray needs some of its values
replaced - to add or remove a text emphasis for example - and the
current idiom for that is the hideous snippet
runs _ runs copyReplaceFrom: start to: stop
with: ((runs copyFrom: start to: stop)
mapValues:
[:attributes | Text addAttribute: att toArray: attributes])
Which personally I find rather ugly. It's also rather inefficient,
involving I think 5 partial copies of the RunArray and assorted
redundant crapulence.
Somebody with a little time to spare might increase their karma
considerably by providing a nicer method for this. Perhaps
RunArray>from: startIndex to: stopInde mapValue: [:originalValue| "a
block returning whatever is supposed to replace originalValue"] ?
tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
More information about the Squeak-dev
mailing list
|