Re: List manipulation question
- To: mathgroup at smc.vnet.net
- Subject: [mg67220] Re: List manipulation question
- From: "Borut Levart" <BoLe79 at gmail.com>
- Date: Tue, 13 Jun 2006 01:07:07 -0400 (EDT)
- References: <e6im0e$pq7$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I can see now that my solution is very similar to the last one, of Bob Hanlon, his is better though in a usage of ListConbolve, Rotate namely must be familiar to everybody. (Everybody should learn something new every day. :) diff[l__]:=Flatten[{ l[[2]]-l[[1]], Drop[(RotateLeft[l,2]-l)/2,-2], l[[-1]]-l[[-2]]}] Anyway, my first working solution was by using rules: list/.{first_,inb__,last_} :> { {inb}[[1]]-first, Drop[(RotateLeft[list,2]-list)/2,-2], last-{inb}[[-1]] }//Flatten Good bye, Borut Levart from Slovenia.