Considering I have a list:
F = {f1, f2, f3, f4}
I want to perform exponent on the list
F = Power[#, 2]& /@ F
Now I want to do the same but with conditions. I want to perform Power[#, 2] on the elements of F that are not equal to NULL and the result of Power[#, 2] is not null.
Thanks.
UPDATE:
Let's say I have
`A = {x, y, z}`
SomeAction[t_] := ...
SomeAction[#] &/@ A
Let's say x = NULL
As Harry commented SomeAction[#] &/@ Select[A, !(# === NULL) &] will work only on y and z.
Let's also say that SomeAction[y] = NULL, and in this case I want to take the original y.
So I want to have following
A = ...SomeAction[#] &/@ Select[A, !(# === NULL) &]... be equivalent to
A = {y, SomeAction[z]}
list = {1, 2, 3, Null, 4}; MapAt[#^2 &, list, Position[list, x_ /; ! (x === Null), {1}, Heads -> False]]? – Harry Feb 16 '15 at 11:08list = {1, 2, 3, Null, 4}; #^2 & /@ Select[list, ! (# === Null) &]? – Harry Feb 16 '15 at 11:11Listableattribute it usually much faster than usingMapin this way, so you could tryF^2 /. Null^2 -> Null. – C. E. Feb 16 '15 at 11:12