Using the where clause to define a local function