using generators in a unix pipe like manner