Rule-based symbolic programming in Maxima?



I need a little help with this:

I want to create a program to compute symbolic z-transforms.  The program
will work by checking the input expression against a small list of standard
functions (constant, powers, exponential, trigonometric), and produce an
output if the input is one of these function types.  Failing that, the
program should check a set of rules to reduce the expression to simpler
expressions.  For example

ztrans(a^n) should produce z/(z-a)  [a^n is a simple function]

but

ztrans(n^k*a^n) should apply the rule about what to do when multiplying by a
power

... lots of other rules ...

Now, this is very likely trivial, except that I have no experience in
rule-based programing.  So what I want is an example program I can use as a
guide.  Can anybody recommend one?

Thanks,
Alasdair