How should one pipeline an index into an indexer property of eg.: a Map?
let aMap = [
(1,'a')
(2,'b')
] |> Map.ofList
let someChar =
1
|> aMap.Item
In the example above, I get the error that "An indexer property must be given at least one argument"
The following works, but in real code gets kind of ugly and strange looking. Is there a better way? What is the language reason for not accepting the pipelined item for the indexer property? is it because it is a getter property instead of a simple method?
let someChar =
1
|> fun index -> aMap.[index]
Edit: below is a better representation of the actual usage scenario with the solution I went with inside a transformation pipeline eg.:
let data =
someList
|> List.map (fun i ->
getIndexFromData i
|> Map.find <| aMap
|> someOtherFunctionOnTheData
)
|> (*...*)