unfold function

It takes an initial value and a function that returns the "next" thing and unrolls the initial value into a List.