libcore: add an UnfoldrIterator like Haskell's `unfoldr`