Using the reduce() and partial() functions