in reply to functions inside patterns

You could also look at match-time code evaluation (?{ CODE }) and match-time pattern interpolation (??{ CODE }) - covered in Chapter 5 of the Camel Book.

andy.