March 2008 Entries

Euler Project Problem 14 in F# - An exercise in optimization

Euler Project Problem 14 in F# - An exercise in optimization The coding “coding-experiments” blog presents two alterative solutions to the “Euler Project Problem 14” (http://projecteuler.net/print.php?id=14): http://coding-experiments.blogspot.com/2008/03/projecteulernet-problem-14-csharp-vs.html   His F# solution is around 55 times slower in than the C# version, the implication being that while F# is elegant, it’s also slow. My problem with this conjecture is that that the implementation of the F# version is considerably different to the implementation of the C# version. So lets have a look at the two different version, first the F#:     let seq_length n =         n |>         Seq.unfold(fun x ->                     match x...

Abstraction of Control Flow

One thing functional languages excel at is abstraction of control flow. Although you may not be familiar with the term, you’re probably already familiar with the concept. Programmers coming from an OO background are generally familiar with implementation polymorphism (overriding a method in a base class) and dependency injection (using an interface or base class to call methods an object, dynamically generated or otherwise); these are both forms of abstraction of control flow. They both allow the programmer to implicitly choose a different method to execute as long as that method conforms to some predefined signature. Let’s quickly remind ourselves...

Links

 Subscribe in a reader
Twitter Follow me on Twitter
FaceBook View my Facebook
LinkedIn View my LinkedIn Profile Viadeo Viadeo Profile (Français)

Badges



Disclaimer

The views expressed on this weblog are mine and do not necessarily reflect the views of my employer.

All postings are provided "AS IS" with no warranties, and confer no rights.

www.flickr.com
This is a Flickr badge showing public photos and videos from Robert Pickering. Make your own badge here.