Functional Functions

Jared Parsons wrote a post very similar to one that I have been wanting to do for a while. Check it out: http://blogs.msdn.com/jaredpar/archive/2008/12/02/mapping-linq-to-f.aspx

His post maps the common C#/VB.NET LINQ methods to F# function names.

I like to think about this a little differently. There are a bunch of well known functions in programming which tend to get used a bit more in functional programming. C#/VB.NET and the BCL names things rather unintuitive if you are accustomed to the functional names for these functions.

The basics:

map Select
reduce Aggregate
filter Where

To throw a little more confusion in the mix, there are aliases and special cases for reduce.

Fold is an implementation of reduce which implies some order to how the reduction is performed. Usually fold is an alias for fold right, which means go from left to right. The other is fold_right which does the same thing but goes from right to left.

Sum, Max, Min and Average are all special cases of Aggregate or reduce.

If you are new to functional programming it will help to remember all of this. Read the wikipedia page for map: http://en.wikipedia.org/wiki/Map_(higher-order_function) and be sure to look in the See also section for the reduce page and the external links for this link: http://www.cse.unsw.edu.au/~en1000/haskell/hof.html

— begin joke here —

F# does an interesting thing and names its generic generator function “unfold” since it is the opposite of fold. This means it is the opposite of reduce. Since any specific functions implemented with fold can be considered a reduction function, and in chemistry reduction has an opposite, I like to call the concept of unfold by the name “oxidate” or “oxidize”. e.g. here is an oxidation function for Fibinacci sequence until the value is one million. It is lifted from Chris Smith’s blog:

let fibs =

        (1,1) |> Seq.unfold

            (fun (n0,n1) ->

                if n0 <= 1000000 then

                    Some (n0, (n1, n0 + n1))

                else

                    None)

Finally, there is one more similar terminology: generators.

Python calls methods like this “generators” although the docs in PEP 255 also calls them “producer functions”. PEP 289 defines a short hand expression for these things which is very similar to F# sequence expressions.

Now that IronPython is 2.0 final and we know F# will be shipped with Visual Studio 2010, please remember that sequence expressions in F# and generator expressions in python are just two forms of oxidation.

Windows Home Server is cool, but confusing

I want to test file restore, so my first instinct is, use Windows Explorer.

After hunting around, the only thing I can find is the Backup Now button in the properties for the C drive.

Very strange that “Backup Now” doesn’t start a backup wizard, but instead displays the Backup Status and Configuration screen which includes restore functions.

BackupNow_2008-12-04_21-00-37

Weird, but it does have for what I was looking… Restore.

OH no!

nobackups_2008-11-30_11-44-34

It says “There are no backups available on this computer.”

That is scary to me as a user. Fortunately I realize that MS just doesn’t use their vista backup system to backup with Windows Home Server. I can’t imagine why not. Is it not good enough?

So far, the only way I have found to restore files with Home Server is to actually login to the Home Server Console. Good enough, I guess.

Opera, Chrome, Konqueror, Safari and other Non Firefox and Internet Explorer browsers

Should be considered just as important as Firefox and Internet Explorer.

Unfortunately, not even Chrome is given 1st class status as a browser by Google:

googleOperaFail_2008-12-02_10-55-39

in case you cannot read the image it says “Page editing not supported in your web browser. Download a new copy of Firefox or Internet Explorer to edit pages.”

Its 2008 Google, the browser wars used a Terminator style time travel device to show up on my doorstep in a sphere of lightning.

Live Mail Beta is a bummer software fail

Using beta software is sometimes a bummer

windowslivemailfail_2008-12-02_22-49-10

That one is at least a nice descriptive message. Actually, after killing the wlmail.exe process it fires right back up.

WindowsLiveMailBeta_2008-10-28_09-52-42

This one is a bigger bummer that I ran across a while ago, but after finding the Contacts folder burried in AppData some place, and renaming it, the program at least ran. I am disappointed to have lost my contacts.

Other than those two glitches, Windows Live Mail is a very nice and FAST (I’ve been dragging along with Thunderbird) email client.