add implementation/tests for truncate function
added truncate doc in README