Make `take` tail recursive.

Summary:
Make `take` tail recursive so it only consumes O(1) stack
space.

Test Plan: Tested on regular cases and corner cases.

Reviewers: pad

Reviewed By: pad

CC: rpatterson

Differential Revision: https://phabricator.fb.com/D721424