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<string>
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
|> Seq.iter(fun (name,ver) ->
name + "." + ver
|> fun pkgName ->
!! ("./src/packages/*/" + pkgName + ".nupkg")
|> Seq.iter(fun pkg ->
global.NuGet.ZipPackage(pkg).GetFiles()
|> Seq.iter(fun file -> filename file.Path |> 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