Towards Cognitively Plausible Associative Memories Capable of Learning Complex Tasks