Although this StackOverflow question about "islands and gaps" is titularly about Perl, the SQL answers are very nice. Apparently this is a FAQ for SQL.
However, this has bugged me for years on the CPAN side, but never enough to make me really do anthing about.
I thought there was a Perl module that did this, and it was in the context of a usenet reader that would take a list of article IDs, such as 1, 2, 3, 4, 5, 7, 10, 11, 15 and return something like 1-5,7,10-11,15
as a more space-efficient store of all the articles you had read.
Every time I've looked I've stopped after 15 minutes because I get distracted and I've never really needed this except to answer someone else's question. I'm not asking how to solve this because there are plenty of algorithm tutorials out there. Surely this is on CPAN somewhere.
There are plenty of options to go the other way and to ask if a number is in one of the ranges.
- Usenet was pre-web reddit, and comp.lang.perl and comp.lang.perl.misc are where I got my start in the Perl socials before there was "social".
submitted by /u/briandfoy
[link] [comments]
Perl: makes array of item ids shortened
So, I have a large set of numbers, basically 1001 .. 150000 for a database using MySQL There are a ton of gaps in the IDs on the database, so not all IDs exist. It can go from 100000 - 10500, then ...Stack Overflow