Lazy functional programming with Javascript generators