Why doesn't -1 work to subtract 1?

I tried to encode with the PDC2008 Intro to F # video . I get an error in the last line of the code snippet below (that the presenter did not receive) "Error 1 This value is not a function and cannot be applied." I am running Fsharp-1.9.6.2 in the shell of Visual Studio 2008. The startPrice in the last line is underlined in red with the same error on hover. Thanks in advance!

 type StockAnalyzer (lprices, days) = let prices = lprices |> Seq.map snd |> Seq.take days static member GetAnalyzers (tickers,days) = tickers |> Seq.map loadPrices |> Seq.map (fun prices -> new StockAnalyzer (prices, days)) member s.Return = let lastPrice = prices |> Seq.nth 0 let startPrice = prices |> Seq.nth (days - 1) lastPrice / startPrice -1. 
+3
source share
1 answer

Try putting a space between "-" and "1". The F # compiler interprets -1 as a literally negative value of 1 instead of subtracting 1.

+5
source

All Articles