F# Impressions

Last December I decided to start to learn properly F#. Before that I only had done the usual explore and play to have an idea of the language. Anyway, I started to read Programming F# 3.0 by Chris Smith complemented by Expert F# 3.0 by Don Syme, Adam Granicz and Antonio Cisternino. Two excellent books without a doubt.

However, nothing beats actual practice and after I felt a bit comfortable with F#, I started my usual “Hello World” project: an Evolutionary Algorithm library/framework. Personally, this is my ideal beginner project since I can only focus in the learning the language and the task has a good deal of complexity that allows to explore the programming language in many ways. Until now I have completed three iterations, starting with a simple Genetic Algorithm using only the more basic constructs and focusing more in the functional approach, to something more generic and library-like exploring the multi-paradigm functionality of F#.

The impressions so far have been very positive. It mixes very well the functional and object-oriented approaches and the support to switch to parallel programing is very good (for example, you can just change Array.map to Array.Parallel.map). The thing I miss most so far it’s macros like in Common Lisp. I’ve already faced two/three situations which were “screaming” for a macro but I assume this is also a sign that I still need to program more in F#. I haven’t used F# so much in a script way like many people do but that’s something that I need to explore more. I feel it’s a nice language and should be worth knowing it better, especially if you need to work with .NET.

6 thoughts on “F# Impressions

  1. @kot_2010

    Could you please show the code which screams for LISP-like macros? I suspect there’s an elegant solution in F#.

    1. Hi, thanks for the comment. Yes, I’m sure there is an elegant solution in F# and I would like to learn it :) I will upload the code to github shortly and then share it.

      1. The code is here: https://github.com/jorgetavares/Genome. My main issue is with the duplication of code in Ga.fs when trying to make it easier to define/configure different types of algorithms.

  2. […] Jorge Tavares posted “F# Impressions“. […]

  3. I’m sorry. You must be some kind of a bot. Nobody writes the following sentence.
    《I started my usual “Hello World” project: an Evolutionary Algorithm library》
    :-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: