1 /* <lambda>null2 * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 // This file was automatically generated from flow.md by Knit tool. Do not edit. 6 package kotlinx.coroutines.guide.exampleFlow08 7 8 import kotlinx.coroutines.* 9 import kotlinx.coroutines.flow.* 10 11 suspend fun performRequest(request: Int): String { 12 delay(1000) // imitate long-running asynchronous work 13 return "response $request" 14 } 15 <lambda>null16fun main() = runBlocking<Unit> { 17 (1..3).asFlow() // a flow of requests 18 .map { request -> performRequest(request) } 19 .collect { response -> println(response) } 20 } 21