I would like to simplify the following block of code to get rid of the let
expression
let jsonFeed = feed |> Fbjson.Parse
jsonFeed.Data
|> Seq.head
|> isPromotion triggerInterval
|> getDecision
Instead I would like to pipe all the way through right from feed
. How do I specify the Data
member to be passed to Seq.head
?
This is easily done with a lambda-expression:
feed |> Fbjson.Parse
|> (fun f -> f.Data)
|> Seq.head
|> isPromotion triggerInterval
|> getDecision
That said, I really don't understand the desire to get rid of let
. If you're worried about polluting the namespace, you can always hide it within a nested block:
let decision =
let feedData = feed |> Fbjson.Parse
feedData.Data
|> Seq.head
|> isPromotion triggerInterval
|> getDecision