I recently needed to supply two variations of an algorithm in an F# source file – one for .NET 3.5 consumers and another for .NET 4.0 consumers (the later framework version allows parallel execution using the FSharp.Collections.ParallelSeq). One way is to tell msbuild to reference the library, conditional on the version of the .NET framework – and also, define a constant which can be used within the source code to choose the algorithm.
In msbuild, define a constant according to the framework
<PropertyGroup Condition=" '$Framework' == 'NET35' "> <DefineConstants>NET35</DefineConstants> </PropertyGroup> <PropertyGroup Condition=" '$Framework' == 'NET40' "> <DefineConstants>NET40</DefineConstants> </PropertyGroup>
In msbuild, reference library if .NET 4.0
<ItemGroup Condition=" '$Framework' == 'NET40' "> <Reference Include="FSharp.Collections.ParallelSeq"/> </ItemGroup>
Specify conditional compilation directives in the source code
let doMapping = ... // some transformation
#if NET35
items |> Seq.map doMapping
#else
items |> FSharp.Collections.ParallelSeq.PSeq.map doMapping
I’ve updated my hobby project to take keyboard input. This ought to be pretty simple, but I came across a few snags that stopped the user experience being as smooth as should be.
I love the title of this book, the authors kept the content as concise as possible and showed that it really is possible to give a decent introduction to a programming language in just 156 pages (and less than 1cm). The book is quite practical you can read it cover-to-cover to pick up the features of the language, then you can use the handy code snippets as a quick reference guide (and the index is pretty good for this too, not always the case).
This is the 2015 Jack Reacher thriller which I received in a lovely hard back edition for Christmas. I was lucky to hear 
I’ve been working on a hobby project for a while, learning Swift and gaining some experience of iOS App development. I reached the stage where the app was worth testing on my iPhone, but found that my version of Xcode (an early v7 beta) required an Apple Developer Licence!
I was lucky to get an invite to this month’s ACCU London meet-up on the topic of sorting. Dietmar Kuhl hosted the presentation at the plush Bloomberg offices on Finsbury Circus. The talk brought together a sample of approaches to speeding up QuickSort: