Re: functional programming

*To*: mathgroup at smc.vnet.net*Subject*: [mg75177] Re: functional programming*From*: dh <dh at metrohm.ch>*Date*: Thu, 19 Apr 2007 04:36:08 -0400 (EDT)*References*: <f04n9k$8ec$1@smc.vnet.net>

Hi Raj, you can not use 2 pure function in abreviated form (#&)in the same expression because then it is not clear to which function the argument # belongs. Therefore, for at least one function you must use the verbatime form Function[..,..]: var=1280; Select[{{35,38},{2064,2068},{2182,2183}},Function[x,#-1281<=x[[2]]<=1280]]&/@ {1280,2000} hope this helps, Daniel Raj wrote: > Could somebody tell me how to do this > > tsome = {{35, 38}, {2064, 2068}, {2182, 2183}}; > Select[tsome, 1280 - 1281 =E2=89=A4 #[[2]] =E2=89=A4 1280 &] > > Now instead of using 1280 in the Select function, I want to use a > variable and get the values as this variable varies. I know that a > Table can be used and the value of the variable can be varied. But if > possible, I want to do it in a "Truly functional way". > > for example something like > > Select[tsom, var-1281<=#[[2]]<=1280&]&/@{list of values over which the > variable varies} > > Thanks, > > Raj > >