by minor_nitwit · 12y ago · 0 comments
c = []; a.lines{c << a.pos}
As far as $, you may know it from Regex as the new line indicator. c=[];n=0;a.lines{|x|c<<(n+=x.size)-1}
but $"\n" wasn't special, and this allocates tons of memory. tinco's implementation is much closer to what k is actually doing.