Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10714

Re: case of inconsistent API between Drop and Part?

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: case of inconsistent API between Drop and Part?
Date 2012-07-01 06:09 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jsopik$u0$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 6/30/12 at 5:17 AM, nma@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}

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: case of inconsistent API between Drop and Part? Bill Rowe <readnews@sbcglobal.net> - 2012-07-01 06:09 +0000

csiph-web