Question: How to create a function that takes as function or an expression?

q := (f)->local ff := `if`(type(f,procedure),f,`x`->f); ff(z + (ff(k))):

Trying to create something so that I can do q(x) or q(x->x^2) or whatever.

Trying to understand the difference between an expression and a function as represented by maple. I thought I could just turn whatever is passed to q, such as x*cos(x) in to a function by x->x*cos(x) as one would do normally but this does not work.

Please Wait...