assignment 2 higer order function