Re: Nesting functional commands
- To: mathgroup at smc.vnet.net
- Subject: [mg102898] Re: [mg102875] Nesting functional commands
- From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
- Date: Wed, 2 Sep 2009 03:59:25 -0400 (EDT)
- References: <200909010751.DAA18675@smc.vnet.net>
Hi, in this case it is easy. Just "say" how you want it with braces A = {1, 2, 3, 4}; Select[(3*# & /@ A), (# < 7 &)] in other examples this would not work. Then you have the chance to use Function[{x,y,..},...] and it gets clear to Mathematica. Cheers Patrick On Tue, 2009-09-01 at 03:51 -0400, Erin Noel wrote: > Hi, > > So how would you go about nesting a functional command inside of another > functional command? For example, say A={1,2,3,4}, then 3*#&/@A = {3,6,9,12}. > No problem. But then what if, within that vector {3,6,9,12}, I wanted to use > the Select command to choose elements less than, say 7. The command > Select[3*#&/@A,#<7&] doesn't work because, as far as I can tell, Mathematica > doesn't know which "#" belongs to Select and which "#" belongs to the &/@ > mapping over A. I know that I could define 3*#&/@A as a new variable and > then use that new variable in the Select command, but is there any way to > nest multiple commands in this way? > > Thanks a lot in advance, > Erin > >
- References:
- Nesting functional commands
- From: Erin Noel <enoel2@gmail.com>
- Nesting functional commands