Lifelong Machine Learning of Functionally Compositional Structures