I’m looking for an algorithm that converts a list of integers (for instance of…
Posted by jpluimers on 2016/09/28
Got a very quick response Range combo – Paste.ie – Irish For Pastebin on:
I’m looking for an algorithm that converts a list of integers (for instance of pages to be printed) from this form:1,2,3,4,6,7,8,13,14into1-4,6-8,13-14… – Jeroen Wiert Pluimers – Google+
I’ll write some unit tests soon and make it into a unit for testing.
For now it looks exactly what I need. In addition, I learned how this algorithm is called Range extraction – Rosetta Code and the opposite Range expansion – Rosetta Code.
Basically these lists are the format where a user can enter the range of pages to be printed.
The code by Asbjørn Heid uses a Functional record definition allowing for function binding just like in C++ Boost.Bind [WayBack].
Based on that, I made this changeset: https://bitbucket.org/jeroenp/besharp.net/commits/7205b070a4e6457675a083b78d26659da506fc08
via: I’m looking for an algorithm that converts a list of integers (for instance of…