I need to replace all integers k in a list with {k} and tried: (# /; AtomQ[#] -> {#} &) /@ {{{{1, 2}, {1, 3}, {2, 3}}, {3, 2, 1}}, 4} which gives the result {{{{1, 2}, {1, 3}, {2, 3}}, {3, 2, 1}} /; AtomQ[{{{1, 2}, {1, 3}, {2, 3}}, {3, 2, 1}}] -> {{{{1, 2}, {1, 3}, {2, 3}}, {3, 2, 1}}}, 4 /; AtomQ[4] -> {4}} the command (# -> {#}) & /@ {1, {2}} works fine (i.e. encloses all elements in brackets). Replacements can be restricted via conditionals according to Mathematica documentation. I am not clear on why (# /; AtomQ[#] -> {#} &) does not have the desired effect of enclosing 4 in brackets (in the example given at the outset)