@dataman, Yours is significantly more readable too. Maybe if you provide a 
pull-request, plus evidence of correctness, it could be integrated into the 
standard library.

  * 
[https://github.com/nim-lang/Nim/blob/master/lib/pure/strutils.nim#L1717](https://github.com/nim-lang/Nim/blob/master/lib/pure/strutils.nim#L1717)



Meanwhile, @andrea's `memoized` macro is a work of art:

  * 
[https://github.com/andreaferretti/memo](https://github.com/andreaferretti/memo)



(Memoization is a bit slower than optimized pre-calculation, of course.)

Reply via email to