tags:

views:

189

answers:

2

I was trying to code along with the PDC2008 Into to F# video. I get an error in the last line of the code snippet shown below (that the presenter did not get) "Error 1 This value is not a function and cannot be applied". I am running Fsharp-1.9.6.2 on Visual Studio 2008 shell. The startprice symbol in the last line isunderlined red with same error on mouse over. 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  A: 

Try putting a space between the "-" and "1". The F# compiler is interpretting -1 as literraly a negative value of 1 instead of subtract 1.

JaredPar
A: 

THANKS! ...that fixed it!

mspan
Glad to hear it. Can you accept the answer then :)
JaredPar
sorry about that .. this was my first post on stackoverflow...
mspan
No problem. Welcome to SO
JaredPar