reset password
Author Message
rabbott
Posts: 1649
Posted 17:02 Oct 21, 2016 |

We have been using function composition (.) for quite a while. Most people understand that (f . g) x = f (g x). But many don’t seem to understand what the (.) function does. I want you to be able to explain what it does, i.e., what its arguments are and (more important) what its output is.  (Hint. The output is a lambda function.)

You should be able to say what that lambda function is and why it makes sense as the output of (.). In particular, if we write

> h = f . g

you should be able to explain what the function h looks like—and explain it without talking about arguments passed to h. Show h as a lambda function.

Another way of putting this is that you should be able to write your own composition function.

myComposition f g = <your definition>

> h = (^2) `myComposition` (+4)

> h 1

25

I've added this to Project 6. If you already have credit for project 6 please ensure that anyone to whom you give credit understands this material.