a[[0]] equivalent to a[[-1]] and so forth
- To: mathgroup at smc.vnet.net
- Subject: [mg65120] a[[0]] equivalent to a[[-1]] and so forth
- From: "Alexandre Costa" <amscosta at uem.br>
- Date: Wed, 15 Mar 2006 06:28:37 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Group, I have a simple issue: If I have a list such as : a = {4, 5, 6}; How can I do this in an elegant way: a[[0]] equivalent to a[[-1]] a[[-1]] equivalent to a[[-2]] and so forth. I thought of a[[If[i <=0, i - 1, i]]] would solve the problem but I want a more elegant way of doing this. Any help is very welcome, Thanks, Alex