foundation icon indicating copy to clipboard operation
foundation copied to clipboard

String: revTake, revDrop, revSplit work from the end

Open vincenthz opened this issue 8 years ago • 0 comments

Currently the length is calculated in o(n) before applying the reverse operation (revTake n == drop (len-n)), this is not optimised. we can use the UTF8 encoding continuation bytes to know how to process the string from the end without calculating the length.

The initial step is adding a prev function akin to next in Foundation/Primitive/UTF8/Base.hs, then a revIndexN (name for forward is: indexN)

vincenthz avatar Jun 09 '17 15:06 vincenthz