https://bugs.documentfoundation.org/show_bug.cgi?id=167691

--- Comment #3 from vic <[email protected]> ---
To tackle the above, it's better to separate the cases with only numbers vs
with numbers and empty cells. 

Thus I'll focus first on number-only patterns. Please let me know if I better
submit a separate proposal for this. 

I have explored many common patterns & ideas. 
Here's a pattern rule that I think it's one of the simplest but also more
powerful than what's currently in use: 

Start with the linear (arithmetic) pattern, indicated by 2 numbers that the
users enters:
a, b
from which Calc infers d(delta)=b-a, to add to current number to get next,
every time. 

Generalize it to 2 groups of equal count of numbers each. 
For instance, user enters 4 numbers, meant to be 2 groups of 2 each:
a1 a2 b1 b2
where now there are 2 deltas/changes, for each pairs of numbers in
corresponding positions:
d1=b1-a1; d2=b2-a2
meant to be applied to numbers in current group to get the numbers of the next
group. 

Some example patterns that are easily generated by such a rule:
p1: 1,3 => 5,7,9..             (groups of 1 number each, d=2)
p2: 1,1,1,3,3,3 => 5,5,5,7,7,7.. (groups of 3 numbers, d1=2, d2=2, d3=2)
p3: 1,3,5,1,3,5 => 1,3,5,1,3,5.. (groups of 3 numbers, d1=d2=d3=0)
p4: 1,2,3,2,4,6 => 3,6,9,4,8,12.. (groups of 3 numbers, d1=1,d2=2,d3=3)

You can see that this rule covers all patterns currently possible in Calc
(periodic, w/CTRL, and "increase each by 1" ) and much more. 

In particular, p2 is not currently possible in calc by pattern continuation. 
I have encountered it in practice wanting to have:
2000,2000,2000,2000,2001,2001,2001,2001... 
I have noticed another user
(https://bugs.documentfoundation.org/show_bug.cgi?id=157731) wanting a similar
pattern with letters:
A,A,A,A,B,B,B,B,C,C,C,C...
which will be possible too, with my rule above, once Calc implements a way to
increment letters, indefinitely 
(https://bugs.documentfoundation.org/show_bug.cgi?id=65198)

What if the user does not enter 2 groups of exactly same count? 
If 3 or more groups - then Calc can check the above still holds. 
If unequal groups => Calc can fall back to what it is doing now. 

The above rule can ge generalized to cases when empty cells are involved - but
on this later. 

What do you think? Any chances to be implemented?

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to