- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Your challenge is to create a function that takes an unsorted list of integers, say
'(22 4 15 3 14 1 9 16 2 21 23)
and turn it into an ascending list of ranges, i.e.
'((1 4)(9)(14 16)(21 23))
THEN create a function that turns the ranges into a string, i.e.
"1-4, 9, 14-16, 21-23"
AND THEN create a function that turns the string back into a list of ascendingly sorted integers (not ranges).
<BTW, I hope my examples are correct 'cause i created them only by eye.>
Note that the value of turning the string into a list might be very handy in the context of a dialog by allowing the user to enter ranges of numbers rather than one after another after another (and there might not otherwise be enough room).
Sure, Lee Mac and/or Kent Cooper have probably already published all this, but if you submit their work, they get the credit, not you. Though imitation is a form of flattery, we would like to see original work. Besides, yours will be better anyway, right?
John F. Uhden
Solved! Go to Solution.