Functions in rules

In this case a look into the following thread might help.