Padding arrays with reversed elements
- To: mathgroup at smc.vnet.net
- Subject: [mg45636] Padding arrays with reversed elements
- From: Mariusz Jankowski<mjankowski at usm.maine.edu>
- Date: Fri, 16 Jan 2004 19:57:21 -0500 (EST)
- Organization: University of Southern Maine
- Sender: owner-wri-mathgroup at wolfram.com
Hi all, a recently posted question on "creating a toroidal data structure" and the the responses have inspired me to post the following similar but harder problem. I am interested in "reflected" padding of multidimensional arrays. Here is an example in 1D: {a,b,c,d} -> {a,b,c,d,d,c,b,a,a,b,c,d,d,c, etc} also the padding should be possible on the left or right or both and of course, the length is an argument. I have a complicated looking solution using PadRight, Fold, Partition and would love to see some ideas leading to a possibly simpler solution. Thanks, Mariusz