extended function returning functions to work on primitive functions.