(func, values)
| 95 | print("Example 7") |
| 96 | try: |
| 97 | def combine(func, values): |
| 98 | assert len(values) > 0 |
| 99 | |
| 100 | result = values[0] |
| 101 | for next_value in values[1:]: |
| 102 | result = func(result, next_value) |
| 103 | |
| 104 | return result |
| 105 | |
| 106 | def add(x, y): |
| 107 | return x + y |