Implement `split` function in library.