Extracting meta data from nupkg file with F# looks like C# Linq The code snippet below examines a nuget package file (zip file with meta) and extracts all file names referenced inside. The final result should be a Set&lt;string&gt; with all file names. My problem is that the code looks like a nested Linq query in c# and the usage of Seq.iter blocks me to build the Set collection. Can you please give me some kind of advice how to improve the F# code? Am I missing some fundamental concept?

getDependencies nugetPackagesFile
                |&gt; Seq.iter(fun (name,ver) -&gt;
                    name + "." + ver
                    |&gt; fun pkgName -&gt;
                        !! ("./src/packages/*/" + pkgName + ".nupkg")
                        |&gt; Seq.iter(fun pkg -&gt;
                            global.NuGet.ZipPackage(pkg).GetFiles()
                            |&gt; Seq.iter(fun file -&gt; filename file.Path |&gt; printfn "%s")))


Current output:

Elders.Cronus.dll
Elders.Cronus.pdb
Elders.Cronus.DomainModeling.dll
Elders.Cronus.DomainModeling.pdb
log4net.dll
log4net.xml
log4net.dll
log4net.xml
log4net.dll
log4net.xml
log4net.dll
log4net.xml
log4net.dll
log4net.xml
log4net.dll
log4net.xml
log4net.dll
log4net.xml
Elders.Multithreading.Scheduler.dll
Elders.Multithreading.Scheduler.pdb
protobuf-net.dll
protobuf-net.pdb
protobuf-net.xml
protobuf-net.dll
protobuf-net.pdb
protobuf-net.xml
protobuf-net.dll
protobuf-net.pdb
protobuf-net.xml
Without being able to actually test (I can only guess what getDependencies, nugetPackagesFile, !! and filename are), something along the following should produce your desired set of dependencies:

getDependencies nugetPackagesFile
|&gt; Seq.collect (fun (name, ver) -&gt; 
       !! (sprintf "./src/packages/*/%s.%s.nupkg" name ver)
       |&gt; Seq.collect (fun pkg -&gt; NuGet.ZipPackage(pkg).GetFiles())
       |&gt; Seq.map (fun f -&gt; filename f.Path))
|&gt; Set.ofSeq


or, depending on your taste (kind of DFS vs. BFS)

getDependencies nugetPackagesFile
|&gt; Seq.collect (fun (name, ver) -&gt; !! (sprintf "./src/packages/*/%s.%s.nupkg" name ver))
|&gt; Seq.collect (fun pkg -&gt; NuGet.ZipPackage(pkg).GetFiles())
|&gt; Seq.map (fun f -&gt; filename f.Path)
|&gt; Set.ofSeq


where Seq.collect and map correspond to IEnumerable.SelectMany respectively Select in C#