Is there a way to call a function and have that function use an argument defined in an enclosing function?
e.g.,
set = Table@Range@50;
posE[set_] := Select[set, EvenQ]
tform1[mult_,set_] := (#*mult) & /@ set[[posE]];
t1set = tform1[10, set]
which leads to the following message/error,
Part::pspec: Part specification posE is neither an integer nor a list of integers. >>
I would like posE
to get its argument set_
from the second argument in tform1
(also named set_
).
Is this possible? is there a better way to do this?
(Note that I do not want to combine the two functions into a single function).
Cases[set, x_?EvenQ :> 10 x]
? (without knowing what you actually want to achieve) $\endgroup$