Re: Selecting round parentheses arguments
- To: mathgroup at smc.vnet.net
- Subject: [mg118056] Re: Selecting round parentheses arguments
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Sat, 9 Apr 2011 18:01:32 -0400 (EDT)
- References: <inpf0a$906$1@smc.vnet.net>
On 09/04/2011 12:13, JJ wrote: > Hello again everybody, > Chelly question made me think to something. Suppose I have a list like this: > > p={a b (c 3 d)+a c (b^2 5),b (c+d 4)-a,-(a^3 d) c} > > in which the round parentheses (except for the middle one) are unnecessary > but play a semantic role by dividing some expressions from others with > different meaning. Now let's say I want to extract the expressions inside > those parentheses and obtain > > ans={{c 3 d,b^2 5},c+d 4, a^3 d} > > Is there a quick way to do that? > > thanks First, if you want to do this by hand, it is possible to click inside an expression, and then spread the selection to cover successively larger sub-expressions using Ctrl-. This would allow you to select, and then copy particular parenthesised expressions. Alternatively, you could write code to read a cell in BoxForm, and seek out sub expressions of the BoxForm of the form RowBox[{"("........ I don't know that this would really be worth the effort. David Bailey http://www.dbaileyconsultancy.co.uk