How F# adapts to the way we think – part1
July 29, 2010 by Maurizio Colucci · 11 Comments
This is the first episode of a series meant to show how easily F# adapts to the way we think. I assume no knowledge of functional languages, but I do assume knowledge of an imperative language such as C#.
___
Suppose in your application you want to do the following:
if there is a dog whose name is jerry, print “hello”.
This is how we think, i.e. how the original thought forms in our mind. But, in order to implement this thought in ordinary imperative languages (such as C++ or C# before .NET 3), we’d have to translate it more or less like that:
for each d in dogs
if d.name = jerry then
print "hello"
which is not close to the original sentence. As the conditions to write become more complicated, this kind of code tends to become unreadable and unmantainable.
Let us now see how much more natural it is to express the same idea in F#, and how much closer to the original sentence the F# code is.
In order to translate this to F#, it is useful to slightly rephrase our original thought like that:
if there is a dog D whose name is jerry, then print “hello”.
This is closer to F#, but let us rephrase it again slightly:
if there exists a dog D such that D.name = jerry, then print “hello”.
now the above is practically F#. In fact, the real F# code is:
if exists dogs (fun d -> d.name = "jerry") then print "hello"
as you can see, it reads almost the way you think:
if
|
exists
|
dogs
|
(fun d
|
->
|
d.name = "jerry") then print "hello"
|
| if | there exists | a dog | d | such that | d.name = “jerry”) then print “hello” |
End note:
In the above, the exists function is defined as follows:
let exists x y = List.exists y x
In the next episode I’ll deal with more complicated (but still very common) sentences and show how naturally they translate to F#.
_______
![]() |
Yellow blue soft is a proud Microsoft Bizspark partner. Tabbles (our flagship product) is developed entirely in F#, and WPF using Visual Studio 2010. |
_______
FileSystemWatcher (.net wrapper): doesn’t work on FAT32 (removable or Samba)
July 26, 2010 by Andrea D'Intino · 1 Comment
HELLO WORLD,
We’ve always perceived the FileSystemWatcher as “moody”, meaning that it would work on some disks and not on some other… but we couldn’t quite understand the reasons behind it. It would work on fixed HD but not always on removable drives…
A few days ago we bought 2 of those fantastic mini NAS-adapters, which work indeed fine even if they:
1) have an embedded Linux using Samba to manage the sharing.
2) support only FAT32 partitions.
Of course we started testing Tabbles furiously and we immediately started yelling “OMG, the FileSystemWatcher doesn’t work on Network drives!”. The reason of such a panic attack is that our auto-tagging rules and one click-tagging are based on the FileSystemWatcher and Tabbles looses much of its appeal without those.
After a bit of yelling and hair-tearing we googled “FileSystemWatcher Samba” until we stumble on this article suggesting to use the “Win9xWatcherStrategy class”… deeply moved in the heart, Maurizio tries immediately to implement this but soon enough he finds out that the method “Win9xWatcherStrategy” doesn’t exist in the FileSystemWatcherClass. This means that we’ll probably bin the .net FileSystemWatcher wrapper, and move to the lower-level Win32 function.
For any of you using Tabbles Portable: be aware that for the moment the auto-tagging rules work only if your USB drive is formatted as NTFS… sorry for that but we’ll try to fix this soon!
——
But we also have some good news here: totally out of the blue, Mr. Leandro “O Dragão” posted on our forum a solution to the annoying problem of Tabbles not being able to track files moved with Explorer, have a look at this thread. This is among the most exciting thing that happened to us in the past months…we don’t really know a lot about it yet, but so far it looks really promising – Kudos to Leandro!
(Not sure why, but I believe Mr. Burns would be proud of us!)
Don Syme’s post, tabble sharing + misc coolness
July 13, 2010 by Andrea D'Intino · 1 Comment
HELLO WORLD,
this will be a lazy update… the reason is that the last days were particularly hectic. Let me try and sum it up:
- On Friday we were featured on GOTD.
- Re-installed (read: fought with) phpbb, but now it works fine and has a lot of cool new things, including the much needed open-id mod (which now works like a charm!). I’m planning a blog post about phpbb: I’m not an expert but for sure there is a lot I know that is worth sharing
- Just released the 1.5.9 including Polish (and I just received the Hungarian translation too…will be in the next update).
- Quite a few things fixed/improved in the tabble sharing features
- We sold the first Corporate licenses! Yes – it came as a surprise to us too!!! (The Corporate license will include the tabble sharing features…which is not there yet!)
- Something REALLY cool: Don Syme (the man behind F#) wrote a blog post about Tabbles!
Well, as I’m here, let me share some more visual stuff:
Ok, now look at our GOTD peak here:
Look at how sexy is our yahoo pipe (subscribe to RSS)
And finally, I just sketched this:
GOOD NIGHT WORLD.
P.S.: on a sad note, I’m stuck with the error 0×80004005 whil trying to let people browse shared folder on my Windows Server 2008 (sp2). Looks like there is no way out… anyone? :-O
Shared-tabbles is in beta
July 9, 2010 by Andrea D'Intino · 2 Comments
HELLO WORLD
Our most anticipated feature is now available for beta testing. This is what it looks like right now:
Check the shared-tabbles thread on the forum (or subscribe via RSS).
We’re looking to hear from as many of you as possible out there!
Andrea & Maurizio








