implemented take using unfold.