# How to map Unevaluated over a list

I have a list {a1, a2, ...... , an}, in which all as have been initialized to a number. I want to get:

 {Unevaluated[a1], Unevaluated[a2], ...... , Unevaluated[an]}


Is there a simple way to achieve this using Map, without getting a list of Unevaluated[value of ai]?

unevaluatedF = Function[{x}, Unevaluated@x, {HoldFirst, Listable}];

{a1, a2, a3} = {1, 2, 3};
unevaluatedF@{a1, a2, a3}


{Unevaluated[a1], Unevaluated[a2], Unevaluated[a3]}

you can try also:

{a1, a2, a3} = {1, 2, 3};
Unevaluated /@ Unevaluated@{a1, a2, a3}

(*{Unevaluated[a1], Unevaluated[a2], Unevaluated[a3]}*)

• beat me by ten seconds. +1 Commented May 22, 2015 at 17:13

First a link to a presentation everyone should read:

Now some additional methods:

List @@ Unevaluated /@ Hold[a1, a2, a3]

Unevaluated /@ Unevaluated @ {a1, a2, a3}


More contrived:

Unevaluated @@@ Thread @ Hold[{a1, a2, a3}]

{Unevaluated /@ Hold[a1, a2, a3]} // ReleaseHold

Delete[{Unevaluated /@ Hold[a1, a2, a3]}, {1, 0}]


Is this what you're seeking?

Unevaluated /@ {a1, a2, a3, a4}


(*

{Unevaluated[a1], Unevaluated[a2], Unevaluated[a3], Unevaluated[a4]}

*)

• Not really, a1, a2, a3 are all initialized, so if a1 = 10, I will get Unevaluated[10], which could not be used in Set Commented May 22, 2015 at 16:29