Core functional representation

Resolves #710 when merged, but not even nearly ready yet.

Not sure there is much to talk about yet, I was hoping to get a bit further with it, so everything is subject to change still.
I also think the first step of this change should be to simply _refactor_. If that means that `CoreFn` is not really a core, then I'm fine with that for now. We can figure out how to modify it for use with new optimizations later, after we have the foundation in place.