Tuesday, December 9, 2008

Setting up Visual Studio 2008... What to do when all the Templates are gone.

I bought a Visual Studio license. I was previously running Visual Studio integrated shell . When I installed it, all of the templates were missing. 

This was fixed by opening a command prompt, changing to the ide directory where devenv.exe is located and running the command "devenv /installvstemplates

(make sure VS is shutdown first). 

Wednesday, December 3, 2008

"F-dull": F# beginner's mistake... put a space between '-' and a number

I made a very simple mistake while trying to follow the PDC 2008 Intro to F# lecture. "JaredPar" straightened me out about two minutes after I submitted it to http://stackoverflow.com . Here is the problem and solution: 
PROBLEM:
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. 
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.
SOLUTION:
Try putting a space between the "-" and "1". The F# compiler is interpretting -1 as literally a negative value of 1 instead of subtract 1.
Thanks Jaredpar!
The original stackoverflow post is here.

Monday, December 1, 2008

Microsoft Solver Foundation -Express

Microsoft jsut released an express edition of their optimization framework called "Solver Foundation". The framework can be used with F#. 

Tuesday, November 25, 2008

The best overview of F# that I've seen ...

Luca Bolognese presented an amazing overview of F# at Microsoft's PDC 2008 conference. You can watch the video  here
The Title of the session is "TL11 An Introduction to F#".

I am watching it a second time right now...