## Round-offs in floating-point arithmetic

A friend of mine recently proposed the following problem on twitter: Given f y z =108 – (815 – 1500/z)/y, x0 = 4, x1 = 4.25 and xN+1 = f xN xN-1 then what is x80? Note: This might not be as easy as it looks — Mårten Rånge (@marten_range) October 19, 2013 I didn’t…

## Resources for the F# Presentation at Ronua Roadshow

For those that attended my last evening presentation about F# at Ronua Roadshow in Timisoara (but not only), here is the demo I’ve shown, and one that I planned to show but didn’t due to lack of time. The purpose of these demos was to shown simple Windows Forms applications written in F#. Mandelbrot Fractal…

CategoriesF#

## F# Operations on List

In this post I want to show how you can implement common list operations: union, intersection, difference and concatenation. Concatenation is the simplest of them all, because type List already has a function call append that does everything for you. let concat left right = List.append left right The union of two lists is a…

CategoriesF#

## Parsing ranges with FParsec

FParsec is an F# adaptation of Parsec, a free monadic parser combinator library for Haskell. It can parse context-sensitive, infinite look-ahead grammars, has complete support for unicode input and large files (> 4 GB) and produces excellent error messages. You can download and install it from the above link. To use it in an application,…

CategoriesF#

## Even numbers as sum of 2 primes

A very old unsolved problem in numbers theory, known as Goldbach’s conjecture, says that any even number greater than 5 can be written as the sum of 2 prime numbers. It hasn’t been solver yet, not I will try to solve it. But I decided to write some F# code to display all the possibilities…

CategoriesF#

## Word Reducing Puzzle

I recently found an interesting problem on the web, about reducing words, letter by letter until only one letter remains. Here is a formal definition: We define word reduction as removing a single letter from a word while leaving the remaining letters in their original order so that the resulting sequence of characters is also…

## Game of Life in F#

The Game of Life is a cellular automaton devised by the John Horton Conway in 1970. It is the best-known example of a cellular automaton. It consists of a collection of cells which, based on a few mathematical rules, can live, die or multiply. Depending on the initial conditions, the cells form various patterns throughout…

CategoriesF#

## Applying File Transformations with F#

In this post I’ll show some F# constructs, all put together in a simple application that modifies file names that match a criteria. This would be an application that is started from a console with the following command line options: filesmod.exe -f < folder > [-r] -p < pattern > [-pre < prefix >] [-suf…

## Parallelization in F#

In my last post I was writing about parallelizing loops with Parallel.For in C#. Today I though it would be nice to try that in F#. So, here is the benchmarking of the matrix multiplication and the bubblesort algorithm in F4. Matrices Multiplication I started with a create_matrix function that creates and randomly initializes a…

## F# Resources

Here is a list of, what I consider, good F# resources. Hopefully you’ll find them helpful. Official Documentation Official F# page at Microsoft Research F# manual informal F# documentation Forums and Wikis F# wikicontains articles, tips and sample code hubFSa very good forum focused on F# Blogs Don Syme’s Blog: the blog of F#’s creator…

CategoriesF#