Function composition is very different from passing one function into another and the latter is definitely a concept that most Algebra 2 students would not be able to grok.
def a(b):
m = 0
return b(m)
Or even: def a(b):
m = b(1)
return m+7
I don't see how these are not a form of function composition. I'm definitely no expert. But I'd really appreciate an elaboration so I can learn from any mistake I'm making. compose : (a -> b) -> (b -> c) -> (a -> c)
a `compose` b = \x -> b(a(x))
However, there is a whole spectrum of additionally possible functions which can be built to accept functions as arguments. Here's a couple of example: partial3 : (Integer -> Integer -> Integer) -> (Integer -> Integer)
partial3 f = f 3
map : [a] -> (a -> b) -> [b]
map [] f = []
map (x:xs) f = (f x):(map xs f)
The first one takes a function and applies an argument, 3; the next one takes a list and a function and maps the list using the provided function. The idea of functions as arguments is a very powerful one, and from my understanding one with which people sometimes struggle. compose :: (b -> c) -> (a -> b) -> a -> c
compose f g x = f (g x)
I'm not sure about the math curriculum in USA but in linear algebra you have functions that operate on functions.