다음 코드가 있습니다. Seq.map
과 ignore
사이의 코드는 실행되지 않습니다. 두 printfn
은 실행되지 않습니다. 왜? Seq.map의 코드가 실행되지 않았습니까?
download
에서
printfn "Downloading"
printfn "Downloaded"
를 디버깅하는 시도
links
(이 전체 배관을 강조) 중단 점을 설정.
실행은 첫 번째 중단되지만 중단 점 2, 3은 결코 적중되지 않습니다. (또는 안으로 들어간다). 결과가 무시되기 때문에 F #은 Seq.map
부분을 최적화 했습니까?
let download url =
printfn "Downloaded"
() // Will complete the function later.
let getLinks url =
....
|> Seq.toList
let .....
async {
......
links = getLinks url // Tried to modify getLinks to return a list instead of seq
........
links // execution hit this pipe (as a whole)
|> Seq.map (fun l ->
printfn "Downloading" // execution never hit here, tried links as Seq or List
download l)
|> ignore
는 업데이트 : 나는 for in do
일을 알고있다. 왜 Seq.map
가 아닌가요?
''seq '가 게으르기 때문에'seq '가 이전에 생성되지 않을 수 있습니다. 실행할 수있는 예제, 나는 단지 짐작하고있다. –
링크를 목록으로 가져온 후 Visual Studio의 빠른보기를 사용하여 값을 볼 수 있습니다. – ca9163d9