MathGroup Archive 2012

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

Search the Archive

Re: case of inconsistent API between Drop and Part?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127117] Re: case of inconsistent API between Drop and Part?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 1 Jul 2012 02:08:11 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On 6/30/12 at 5:17 AM, nma at 12000.org (Nasser M. Abbasi) wrote:

>using the Drop function, there is
>no direct way to tell it to Drop element 2 AND element 4 in one
>command.  (there are easy ways to do this, but not using one
>function call of Drop as is). (one easy solution is to complement
>the elements to drop, and use Part instead, and other ways)

This can be done using one call to Drop as follows:

In[5]:= test = Range[8];
Fold[Drop[#1, {#2}] &, test, {4, 2}]

Out[6]= {1,3,5,6,7,8}




  • Prev by Date: Numerical integration over an arbitrary 2D domain
  • Next by Date: Re: how to make a list of rules with 2 other lists composed by different kinds of elements
  • Previous by thread: Re: Numerical integration over an arbitrary 2D domain
  • Next by thread: Re: case of inconsistent API between Drop and Part?