Re: Pure functions and Select[] sequential elements of list
- To: mathgroup at smc.vnet.net
- Subject: [mg119316] Re: Pure functions and Select[] sequential elements of list
- From: "Chris Degnen" <degnen at cwgsy.net>
- Date: Mon, 30 May 2011 06:35:18 -0400 (EDT)
- References: <irtb73$plj$1@smc.vnet.net>
Paul McHale wrote:
>
> Hi,
>
> Does anyone know of a way to use a pure function to access current
> and next element of list with uses like Select[]? ... I.e.
>
> mList={1,2,3,4,5,7,6,8};
> Select[mList, (#? > #??)&]
>
I would use this:
Part[mList,
Flatten[Position[#1 > #2 & @@@ Partition[mList, 2, 1], True]]]