higher order function implementation 2760727