I've been looking for the implementation of List.map in F#. The code in list.fs in dotnet/fsharp on GitHub delegates to a mysterious Microsoft.FSharp.Primitives.Basics.List.map function.
Where is the source of that function? I can't find any such directory path in the repo.
I think this is it:
let map mapping x =
match x with
| [] -> []
| [h] -> [mapping h]
| h :: t ->
let cons = freshConsNoTail (mapping h)
mapToFreshConsTail cons mapping t
cons
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With