I have a question similar to my earlier question, but a bit different
say you have 10 columns on each line, and 100000 lines, I want to check if each row for the following patterns:
If a row looks like this, i want to remove it
lambda a, b, c, d: a==a and a+1==b and b+1==c and c+1==d and d+1==e
While this solution works great, all solutions worked, all followed the same logic. The problem is that say i have 10 rows, That solution removes lines that have 5 consecutive numbers starting from a to e,
If the sequence starts from b to f, it will stay
I want a solution that is controlled by a loop so i won't have to keep adding and removing variables
I mean I want to remove all the sequences greater than 3, in the row,
I mean that if there are 3 consecutive numbers in the row,
a==a and a+1==b and b+1==c leave them, if there are more than 3 consecutive numbers
a==a and a+1==b and b+1==c and c+1==d and so on then remove them, wherever they may occur.
I mean it may be
a==a and a+1==b and b+1==c and c+1==d a==a and a+1==a and b+1==c and c+1==d and d+1==e and e+1==f and so on
So I'd rather to do it in a loop or similar solution, so I don't have to write all possibilities
Like last time, I'd prefer awk or perl for learning purposes, I was told by a friend that haskell can do that easily but I didn't find the solution in haskell, if that's true then I'm curious to know how.
Please note that I don't mind recursive solutions. I will edit my question to give input and output example in few hours, when I get back home
1,2,3,4,5,6,7,8,9 1,5,8,11,14,16,17,18,19 1,2,3,5,7,9,15,29,34 11,22,25,30,40,55,80,83,90
Reason: the third row, contains only 3 consecutive numbers, fourth row, contains no consecutive numbers. first two rows should be removed.