一直没搞明白Partition函数中的参量{kL,kR}的意思,
Partition[list,n,d,{kL,kR}]
specifies that the first element of list should appear at position kL in the first sublist, and the last element of list should appear at or after position kR in the last sublist. If additional elements are needed, Partition fills them in by treating list as cyclic.
按我英文理解水平是,第一个元素出现在第一个子列的位置kL上,最后一个元素出现在最后一个子列的位置kR处,或者之后。但是下面例子,好像与理解有偏差呀,请问各位到底怎么理解?
In[66]:= Partition[{a,b,c,d,e,f,g},3,3,{1,4}]
Out[66]= {{a,b,c},{d,e,f}}
In[67]:= Partition[{a,b,c,d,e,f,g},3,3,{1,5}]
Out[67]= {{a,b,c}}
这里Out[67]= {{a,b,c}}为何不是{{a,b,c},{d,e,f}}?
In[68]:= Partition[{a,b,c,d,e,f,g},3,3,{1,1}]
Out[68]= {{a,b,c},{d,e,f},{g,a,b}}
In[69]:= Partition[{a,b,c,d,e,f,g},3,3,{1,4}]
Out[69]= {{a,b,c},{d,e,f}}
In[73]:= Partition[{a,b,c,d,e,f,g},3,3,{1,3}]
Out[73]= {{a,b,c},{d,e,f}}
像这里Out[73]= {{a,b,c},{d,e,f}}为什么不是{{a,b,c},{d,e,f},{g,a,b}}?
Partition[list,n,d,{kL,kR}]
specifies that the first element of list should appear at position kL in the first sublist, and the last element of list should appear at or after position kR in the last sublist. If additional elements are needed, Partition fills them in by treating list as cyclic.
按我英文理解水平是,第一个元素出现在第一个子列的位置kL上,最后一个元素出现在最后一个子列的位置kR处,或者之后。但是下面例子,好像与理解有偏差呀,请问各位到底怎么理解?
In[66]:= Partition[{a,b,c,d,e,f,g},3,3,{1,4}]
Out[66]= {{a,b,c},{d,e,f}}
In[67]:= Partition[{a,b,c,d,e,f,g},3,3,{1,5}]
Out[67]= {{a,b,c}}
这里Out[67]= {{a,b,c}}为何不是{{a,b,c},{d,e,f}}?
In[68]:= Partition[{a,b,c,d,e,f,g},3,3,{1,1}]
Out[68]= {{a,b,c},{d,e,f},{g,a,b}}
In[69]:= Partition[{a,b,c,d,e,f,g},3,3,{1,4}]
Out[69]= {{a,b,c},{d,e,f}}
In[73]:= Partition[{a,b,c,d,e,f,g},3,3,{1,3}]
Out[73]= {{a,b,c},{d,e,f}}
像这里Out[73]= {{a,b,c},{d,e,f}}为什么不是{{a,b,c},{d,e,f},{g,a,b}}?