# 032: Higher-Order Functions
# Functions that take or return functions

# Function that returns a function
make_multiplier(factor):
  return (x) => x * factor

# Create specialized functions
double = make_multiplier(2)
triple = make_multiplier(3)

show double(5)  # 10
show triple(5)  # 15

# Function that takes a function
apply_operation(a, b, operation):
  operation(a, b)

result = apply_operation(10, 5, (x, y) => x + y)
show result  # 15

result = apply_operation(10, 5, (x, y) => x * y)
show result  # 50
