1.7 pattern example 2
Given list \(3,4,x,x^2,x^3\), find those elements of form \(x^n\) where \(n\) is now allowed to be 1. In Maple
L:=[3,4,x,x^2,x^3];
map(X->`if`(patmatch(X,x^n::anything),X,NULL),L)
[x, x^2, x^3]
In Mathematica
Cases[{3, 4, x, x^2, x^3}, x^_.]
{x,x^2,x^3}