So I love this example that I saw in one of my daily programming newsletters – F# interactive in the browser – no need for VS.

Check it out here…

So I have put up the slides from my ten minute presentation on 1 best practice in F# up for anyone who wants them. Also find a link to Bart De Smet’s presentation on Functional Programming ......

Well after a hectic week of work and studying I eventually had some me time… today I thought I would attempt Euler Problem 16. The Problem 215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 21000? The Solution So I thought I would get to concerned about length of code, but rather focus on implementing several practices that I have learnt in the last couple of weeks, namely tail recursive functions and composite functions… I initially broke ......

A few months ago I had a really frustrating debate with my younger brother. He had come up to JHB to come for a visit and we decided to talk about programming. Of course I thought I would put a good pitch in for F#, but just couldn’t seem to do it any justice. Eventually his point was as follows - “What really is the difference between declaring a functional solution vs an iterative solution. Sure, in F# you have something like the Seq.map function, but isn’t it just a shorthand for a for loop or ......

So today I had the pleasure of attempting Euler Problem 10… the problem goes as follows… The Problem The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. The Solution What I enjoyed about this problem is that if you have done the previous Euler problems, then this problem is really just a focus on pure performance as the other aspects of the problem have in essence been solved before. Not that I have found an optimal solution, in fact I was very ......

For those using VS2010 with F#, this may be a useful reference for the default keyboard shortcuts in VS.

“prefer active patterns over multiple when guards” In line with my previous posts on 5 best practices for F# from Daniel Mohl’s slideshow, over the last few days I have been learning about active patterns. The exact best practice is to prefer active patterns over multiple “when” guards during pattern matching and in this post I am going to try and compare the two techniques and then also explain some of the basics of active patterns and why it is called active. Now before I go any further, let me ......

Another day flown by… another Euler problem to tease me… today I attempted problem 9. The Problem A Pythagorean triplet is a set of three natural numbers, a < b < c, for which a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 +16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. The Solution Initially I thought I would try and tackle this problem by setting up 3DArrays in F#, thus my question on StackOverflow regarding 2D Array. However, if ......

Today I had some more spare time to give Euler a go and thought I would try my luck on problem 8. The Problem Find the greatest product of five consecutive digits in the 1000-digit number. 731671765313306249192251196... 969835203127745063262395783... 858615607891129494954595017... 125406987471585238630507156... 668966489504452445231617318... 622298934233803081353362766... 303589072962904915604407723... ......

In line with Daniel Mohl’s presentation, the third best practice for F# is Tail Recursive Functions. I must admit, while I did go over recursion several years ago, I never heard (or possibly ignored) any mention of tail recursive functions… so what exactly is a tail recursive function? I posed the question on Stack Overflow and got some great examples and responses… Possibly the best explanation came from a post done by Chris Smith entitled Understanding Tail Recursion. Basically, non tail recursive ......