foundation
foundation copied to clipboard
String: revTake, revDrop, revSplit work from the end
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)