2

We know:

Map[Head, {a, a^2, a^3}]
(* {Symbol, Power, Power} *)

and Map[Head, {2, 2^2, 2^3}] all of them will be known as Integers.

But how can we get the result of

Map[Head, {2, 2^2, 2^3}]` 
{Integer, Power, Power} 

I mean how Mathematica recognize a value is a power of two others?

Kuba
  • 136,707
  • 13
  • 279
  • 740
Unbelievable
  • 4,847
  • 1
  • 20
  • 46

1 Answers1

1

You can use solutions from How to map Unevaluated over a list to prepare your list to be mapped with Head. E.g.:

Map[Head, Unevaluated /@ Unevaluated @ {1, 2^2, 2^3}]
{Integer, Power, Power}
Kuba
  • 136,707
  • 13
  • 279
  • 740