Learning to thread a needle