Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

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.


  • Prev by Date: Why does Reduce work this way ...?
  • Next by Date: Determining continuity of regions/curves from inequalities
  • Previous by thread: Re: List manipulation question
  • Next by thread: Re: List manipulation question