Browse by Tags

All Tags » F# (RSS)

Distance between adjacent points in F#

Let’s say you are given a list of data points: [7;5;12;8;5] And you are asked to find the distance between every adjacent pair, that is: [(7-5);(5-12);(12-8);(8-5)] = [2;-7;4;3] It turns out that there is an elegant solution to this problem: let rec pairs...

Free F# libraries (well, almost)

In what was one of the very last PDC2008 sessions, Luca Bolognese did an encore presentation of F#, instead of trying to tell you what it was all about I invite you to watch the video (Luca is engaging and funny, and the session is so packed with information...

Point distance, imperative vs. functional style

Let’s consider a silly simple algebra problem: given a specific point and a set of several other points, find the closest point in the set to the given point. One C# solution is:     1      static class PointMath    ...

The first Visual F# CTP is here!

You leave on vacation for one short week and a lot happens... for example, Don Syme & co. have released the first F# CTP , well on the way (hopefully before this year's end) to put F# on the same level as C#, C++ or VB.NET. As far as I know, this...

F# 1.9.4.19 runs out of the box with Mono in Linux

Don Syme just announced a minor update to the F# environment , minor may be but of great interest to a certain community: it so happens that at some point F# stopped working properly in Linux, a workaround was published (and it actually works, but you...

A cool way to find out whether a number is palindromic

In this blog entry I proposed a solution to Problem 4 at Project Euler , a crucial element of the problem is to find out whether a number is a palindrome (909 is, 809 isn't), a bit out of laziness and a bit in order to reuse existing methods, I decided...

New version of F# just released

In its way from research language to commercial language, Don Syme just announced that, silently, on May the 1st version 1.9.4.15 of F# was released .   This new version incorporates a number of specific enhancements (F# is now basically in stabilization...

Project Euler and functional C#

I think I already talked (a long time ago) about Project Euler : a set of problems, mainly math oriented, keen to be solved with a computer program. To be sure, it's not particularly deep math, but the problems posed go fairly quickly from really easy...

Tuples: an F# lightweight data structure

Maybe the best thing to do is to start by showing a few examples of tuples: let amigo = ( "Sebastián" , 7) let pair1 = (3, 2) let pair2 = (2, 5) let student = "Santiago" , "Monterrey" , 2007, true The first tuple ("Sebastián"...

F# doesn't need parenthesis in functions, or does it?

In a previous posting I mentioned that when you define a function in F# you don't need parenthesis surrounding the parameters, or commas separating them. So, this simple definitions are all valid: let negate a = -a   let add a b = a + b   let...
More Posts Next page »