Suppose I have a list of elements
list = {f[b[G[1]]],f[b[1]],k[k[k[G[1]]]]}
What is the pattern associated to an expression in which the function G[1]
appears at the last level of nested functions? For example, I want a pattern
such that
MatchQ[list[[1]],pattern] (*Returns: True*)
MatchQ[list[[2]],pattern] (*Returns: False*)
MatchQ[list[[3]],pattern] (*Returns: True*)
In general, this pattern should match an arbitrary expression of nested functions, e.g. a@b@c@d@e@f@G[1]
.