Name: Partition - Partition list into n element piece

Synopsis:

array n Partition 
array n d Partition


Examples:

[1 2 3 4 5 6 7 8 9 10]  2 2 Partition -&gt; [[1 2] [3 4] [5 6] [7 8] [9 10]] 
[1 2 3 4 5 6 7 8 9 10]  1 2 Partition -&gt; [[1] [3] [5] [7] [9] [10]] 
[1 2 3 4 5 6 7 8 9 10]  2 1 Partition -&gt; 
[[1 2] [2 3] [3 4] [4 5] [5 6] [6 7] [7 8] [8 9] [9 10]] 
[4 5 6 7 8] 2     Partition  -&gt;  [[4 5] [6 7]] 
[4 5 6]     2 5   Partition  -&gt;  [[4 5]] 
[4 5 6]     5 1   Partition  -&gt;  [] 
[4 5 6]     5 7   Partition  -&gt;  []


Description:

Partition works like the corresponding Mathematica function. Partition 
creates subarrays with n elements, and offset d.


Parameters:

n - length of subarray. 
d - offset of subarray, defaults to n.


Diagnostics:

Raises error if n&lt;0 or d&lt;1


Remarks:

Still implements only part of Mathematica's functionality.


References:

"The Mathematica Book"


Author:

Gewaltig, Diesmann


FirstVersion:

Jun 29 1999, Marc-Oliver Gewaltig


SeeAlso:

Flatten

Source:

/var/www/debian/nest/nest-simulator-2.20.0/lib/sli/mathematica.sli
