Source: https://cse.engineering.nyu.edu/~mleung/CS3113/functions.pdf