Compositional Reasoning with Transformers, RNNs, and Chain of Thought