transform a finite stream to an infinite one