December, 2010


30
Dec 10

F# Discoveries This Week 12/30/2010

What a fantastic year it’s been.  We’ve seen F# go first from a research project to a real language in Visual Studio 2010, and then to Microsoft’s first fully supported open source language.  We’ve seen the F# team work hard to bring us full XNA, Windows Phone 7 and Silverlight support.  We’ve even seen F# user groups and events start to spring up all over the world.

Best of all, we’ve been active participants in the rise of a new class of uber-geek in the Microsoft world: the F# user.  With the power of types we go forth writing tiny snippets of rock solid code that leave pages upon pages of C# obsolete.  Even the most stalwart C++ user must be envious.

I can’t wait to see what’s in store for us next year!

News

2010: A Year of Peerless Accomplishment

“From its inception in 1991, Microsoft Research has hewed to a remarkably unwavering mission. Its tenets are threefold: to invest in basic research to advance the state of the art in computer science, to transfer technologies into Microsoft products when appropriate, and to collaborate openly with the scientific community.”

Interested in F# in the Washington DC area?

“I’ve had some contacts from interested F# users in DC about the possibility of setting up a user group in the area.”

F#/Functional job with the Health Sciences team at Microsoft

“The health sciences team at Microsoft, in collaboration with Microsoft Research, is looking for a key designer/engineer on our team, responsible for significant architecture investments in a challenging and creative environment.”

Audio and Video

Haim Michael’s Collections in F# PRO

“I have just completed to develop the 4th topic (of my on going F# Fundamentals course) that covers the usage of collections in F#.”

Tools

WebSharper 2.0 Beta Bundle

“It’s never been easier to get started with WebSharper 2.0 – now with a single installer that contains six WebSharper project templates for Visual Studio, including integration with ASP.NET, MVC, and Sitelets. Go and grab your installer (renumbered as a bundle, current latest 2.0.21) at the WebSharper Downloads page.”

MonoDevelop is the Third IDE for F#

“MonoDevelop has become the third IDE to support Microsoft’s F# language. With .NET support essentially dead on the Eclipse IDE and WebMatrix being targeted for causal developers, it is likely to be the last IDE to add support for it in the foreseeable future.”

Project templates for F# games, libraries and applications on Windows Phone 7 using XNA

“Johann Deneux and Giuseppe Maggiore have been putting together templates for F# games, libraries and applications for Windows Phone 7 (WP7) XNA. This extends Dan Mohl’s great work on templates for list, panorama and vanilla applications.”

General

Steve Gilham’s Distributed Memory: “Hello, OTP!” from F#

“This is all building on the original work done elsewhere Integrating .NET and Erlang using OTP.NET and Integrating F# and Erlang Using OTP.NET, as a little bit of a five-finger exercise using the OTP framework as now explained in Erlang and OTP in Action.”

Steve Gilham’s “Hello, OTP!” from F# revisited

“That previous F# code was just too ugly to leave as it was; so after a little bit of work, I’ve factored out a general purpose wrapper to convert the Otp.Erlang types into values of a discriminated union on the F# side of the fence.”

Steve Gilham’s F# GUI plumbing with reactive Events

“My most recent “Aha!” moment with the language is to finally wrap my head around the standard Event module — a sort of lightweight subset of the Reactive Extensions for .net”

Mauricio Scheffer’s Zipping with applicative functors in F#

“In my last post I briefly described functors from a F# perspective. Now it’s the turn of applicative functors. Since there were few to none concrete examples in my previous post, this time I’ll start with an example.”

Mauricio Scheffer’s Notes on Haskell functors and F#

“I’ve been learning a bit of Haskell lately, and I wanted to share some of what I have learned so far, from a F# perspective.”

Steffen Forkmann’s Compute Fib(n) in O(log n)

“Today I learned a neat way to compute the n.th Fibonacci number in O(log n) time. The idea is that we can compute the Fibonacci Q-Matrix in O(log n) by using recursive powering”

Joh’s Interactive game development with FSI and XNA

“I recently looked at a presentation by Don Syme about the future of F# and type providers. The entire demo was conducted using F# interactive and a Windows Forms. The same can be done for XNA. First, you need to get the code sample that shows how to embed XNA into a Windows Forms control. It’s available in the education catalog on the App hub.”

Joh’s How to make a visual studio project template

“Here is the simple 14-step procedure to build a template for F# projects targeting exotic platforms.”

Jon Harrop’s Performance-related features in F# and C#

“Many people expect the performance of F# to be comparable to the performance of C# “because they both compile to the same intermediate language (CIL)”. Although the VM obviously places the same ceiling on the performance of both F# and C# there are some features that affect performance differently between the two language implementations.”

Adam Granicz’s Visual Studio book with F# chapter

“The book covers a great deal about .NET 4 and Visual Studio 2010, and has a ~75 page F# chapter at the end for your reading pleasure (this is the part I wrote). As with any book, there may be errors and omissions, if you find any we kindly ask you to send your errata to Wrox.”

F#, xUnit theories and InlineData

“Anyway, just a short heads up to save people some time: in the xUnit extensions, there is a Theory attribute which in combination with the InlineData attribute lets you specify a parameterized xUnit test.”

Exact Cover In Solving Sudokus

“I would finally understand how the Sudoku – solving technique works, and found an article on the Exact Cover problem in relation to Sudoku, a Sudoku solver in F # version and a version of Haskell .”

Guide to F#

“F# is the only language to be added to Visual Studio for a very long time. What makes it so special?”

Community

StackExchange: Real world pitfalls of introducing F# into a large codebase and engineering team

“I’m CTO of a software firm with a large existing codebase (all C#) and a sizable engineering team. I can see how certain parts of the code would be far easier to write in F#, resulting in faster development time, fewer bugs, easier parallel implementations, etc., basically overall productivity gains for my team. However, I can also see several productivity pitfalls of introducing F#, namely:”

The Code Project: Optimize references in closures in F#

“This quick tip shows how to encode a closure as a class in the F# programming language. The advantage is that references are stored as mutable fields in the class, thus removing a level of indirection.”

FsSnip: Break sequence into n-element subsequences

“I’m working on parallel computations and I thought it would be useful to break work into chunks, especially when processing each element asynchronously is too expensive.”


16
Dec 10

F# Discoveries This Week 12/16/2010

The big news this week is Tomas’ launching of a new F# snippet site.  It goes way beyond anything that’s come before it in that you even get Visual Studio style tooltips!  Equally exciting has been been Phillip Trelford’s blog.  He’s been building all sorts of great Silverlight games in F#.  Be sure to check it out!

News

Tomas Petricek’s Announcing F# snippets web site

“Now that I have a twitter (follow me if you don’t already) I thought I could just post the snippet somewhere, but there was no good web site for posting F# snippets – until now!”

The F# Compiler on GitHub

“This is the F# compiler and core library for Mono, based on the F# Powerpack code drop under the OSS approved Apache 2.0 license.”

Audio and Video

Arrays in F# PRO

“I have recently completed to develop a new topic in my on going F# Fundamentals course. This new topic covers the possibilities we have when working with arrays in F#. In addition, it showcases the available language constructs that enable us to get a shorter code comparing with C# (for doing the same operations).”

Editing F# code in VS2010 (and many more videos)

“This video demonstrates using a number of Visual Studio editing features for F#, including customizing syntax highlighting colors, Intellisense for auto-completion, error squiggles, type inference tooltips, and various source code navigation features.”

Tools

F# Refactor

“Deisgned to bring Code Refactoring capabilities to the F# Language in Visual Studio 2010.”

Refunctor

“The project is still under development. As of now, You can try F# interactive inside Reflector. Program editor will be added later.  ”

WebSharper 2.0 Beta 2 released

“We just released a new WebSharper 2.0 Beta (2.0.63) and a matching WebSharper Manager (2.0.10) – please go to the WebSharper Download Page to grab the new binaries.”

FSharpXmlDoc

“Automatically create F# xmldoc template when you type ///”

F# Colorizer Editor

“If you are loving and learning F# like me, you may know about the awesome F# Deep Colorizer VS Extension implemented by Brian McNamara.The extension uses background colorization of the Visual Studio’s Code Editor to show the “control flow depth” of F# code.”

F# PowerPack, with F# Compiler Source Drops Has been updated.

“F# PowerPack, with F# Compiler Source Drops Has been updated.”

General

A Modern Approach to an Ancient Game

“When it comes to the ancient Chinese board game of Go, a certain cliché has gained near ubiquity. The game, the saying goes, takes just minutes to learn, but a lifetime to master”

Phillip Trelford’s Invadurz

“The game was developed in F# using the freely available Visual Studio 2010 Shell and targets Silverlight 4”

Phillip Trelford’s Fractal Zoom

“Time for a makeover with a sprinkling of Active patterns, Reactive programming, Parallel execution and Silverlight.”

Phillip Trelford’s Silverlife

“I’ve managed to increase Jon’s example to a massive 50 lines but at the same time get it running in Silverlight. If you have Silverlight 4 installed you can click in the box below to kick start life.”

Phillip Trelford’s Missile Command

“Just for fun, a clone of the 1980s arcade game Missile Command written in F# and deployed in Silverlight.”

Richard Minerich’s An F# Ant Colony Simulation in Silverlight 4.0 with Dynamic AI Loading

“I’ve been enviously watching Phillip Trelford publish excellent F# games all week and tonight I just couldn’t stand it anymore.  I stayed in, rolled up my sleeves and ported the very same ant colony simulation I used in my CUFP workshop to Silverlight 4.0.”

Robert Pickering’s Solving Sudoku Puzzles using F# and Microsoft Solver Foundation

“While I knew that solving Sudoku in F# wasn’t particularly an original idea, Jon Harrop has a custom Sudoku solver in F# that dates back to 2007, but I thought using Solver Foundation might be an interesting approach.”

Steffen Forkmann’s Sudoku solver in F#

“On my flight to the US I had a small competition with my dad. He was solving a Sudoku and I tried to write a generic solver in the same time.”

Jon Harrop’s Parsing mathematical expressions using active patterns

“Active patterns allow arbitrary user-defined functions to be used to dissect values during pattern matching. This opens up some interesting possibilities with regard to parsing because it allows active patterns to be used to destructure streams of data when known patterns are encountered.”

Joh’s On the performance of F# on the Xbox 360

“In an attempt to answer this question, I am comparing in this article the performance of four implementations of an octree: Two in F# and two in C#.”

Adam Granicz’s Introducing WebSharper 2.0 at LWSUG

“Earlier this week I gave a talk at the first London WebSharper User Group meetup about WebSharper 2.0 and some of its new features such as sitelets and the new Visual Studio templates. This was a longer, class-like talk with many technical points discussed – a great source of information for anyone interested in WebSharper. Here is the short summary of the talk:”

Scraping Links from HTML

“Extracting links from HTML is a bit tricky. The two main issues are relative URLs and the lack of canonicalization (the process of consistently using the same URL pattern for internal links across the hole Web site).”

Getting started with formlets

“In this tutorial you will learn how to create a newsletter sign-up form using WebSharper formlets.”

Frederick Times’ What Protovis might look like through an F# Lens

“Since I love F# and data visualizations I thought to myself that it might be cool to have a Protovis style API for the Charting controls. So I started hacking and surprisingly came up with the following  F# Script :”

Nicholas Cloud’s Getting a Clue with F#

“As a fun project, I decided to implement a guessing strategy for the popular board game Clue, as proposed by Wired magazine in a recent article about teen “mathletes”:”

Stefano Ricciardi’s Project Euler Problem 16 in F#

“I have tried to found an elegant way to solve this problem at a mathematical level, but I couldn’t gain any insight relating powers of 2 to their representation in base 10 (I’d love to know if such a thing exists). Therefore I resorted to solve this problem with brute force.”

Stefano Ricciardi’s Project Euler Problem 17 in F#

“Project Euler problem 17 turned out to be quite an easy one”

Rey Dacoco’s Example 18: Race to Ren Text-Based Game

“Problem: Make a simple Race to Ten text-based game.”

Youhei Kondou’s Studying F# : Local Calendars

“One of the most useful features in .NET/CLR is supporting not only Gregorian calendar but also many local calendars. For me, it is awesome that there is the Japanese Calendar (in Japanese : 和暦 / pronounce “wareki”).”

Brian’s US Federal Holidays in F#

“Here’s how to determine whether a date is a US federal holiday using F#. You probably want to curry the first two boolean parameters with the appropriate settings (some departments observe Sunday holidays on Monday, and some observe Saturday holidays on Friday).”

Mikael Lundin’s Generate machine keys with F#

“This is how I use F# to generate the keys.”

Writing .NET TBB’s in F#

“I rewrote a C# .NET Template Building Block for an SDL Tridion project in F# as a test to see how well F# fit in real-world applications.”

Richard Minerich’s I got 99 problems but dynamic ain’t one

“If you got runtime errors I feel bad for you son
I got 99 problems but dynamic ain’t one”

Community

HubFS – Permutation Generation in F-Sharp

“I had fun writing a generator of permutations in f-sharp. I posted a writeup about it on my blog here.  I welcome any tips on how to improve this code”

StackOverflow – Map Reduce with F# agents

“After playing with F# agents I tried to do a map reduce using them.”


6
Dec 10

F# Discoveries This Week 12/05/2010

Welcome back F# Fans!  While you’ve been busy trying to make holiday shopping lists the F# community has been busy creating great content.  It just goes to show how addictive functional programming can be.

Also, I’m proud to say that we have reached 70 people signed up for the first meeting of our NYC F# User Group tomorrow!  Howard has a great demo in store for you guys, it’s sure to be a crowd pleaser. 

On another note, please let me know if you’re interested in coming out to the area to speak for a future meeting.  We are looking for enthusiastic speakers to come and show just how fantastic functional programming can be.

News

Come and join the F# Compiler & Tools team!

“Come and help us shape the future of F#! We are seeking a talented and highly motivated software engineer with experience in compilers, language tools and data-consumptive programming to help us ship the next version of F#.”

F# + Azure Skills? BuzzNumbers are looking for you…

“Interested in getting exposure to the latest technologies including MVC, F#, .NET 4.0 and Windows Azure?”

Brian McKenna is speaking on F# at the Open Programming Miniconf

“The F# compiler and library have recently been released under an open license. The language is modelled closely to OCaml but runs on the .NET platform. This allows programmers to harness the power of functional and object-oriented programming while still being able to utilise existing libraries.”

Audio and Video

Don Syme’s My Talk at TechEd Europe 2010: A Taste of F# – Today and Future

“Recently I gave a talk at TechEd Europe, in Berlin, entitled A Taste of F# – Today and Future, available below as slides + audio. If you don’t get the player below, then here’s the site with the raw WMV files.”

Tools

FsColorizerEditor – Release: FSharp Colorizer Editor

“The extension uses background colorization of the Visual Studio’s Code Editor to show the “control flow depth” of F# code.”

F# Math: Extreme Optimization 4.0 – 50 Quick Start samples in F#

“The guys at Extreme Optimization have released version 4.0 of their .NET math library.”

General

Brian McNamara’s Source code for F# XmlDoc extension

“I’ve just published the code for another VSIX extension; this one auto creates xml documentation boilerplate when you type triple-slash”

Phillip Trelford’s Fog Index

“The index estimates the years of formal education needed to understand the text on a first reading. Texts for a wide audience generally need a fog index less than 12.”

Tomas Petricek’s F# in Education & Concurrency with Agents

“Now that both of the events are over, I’d like to write a short summary and also finally publish my slides and demos.”

Richard Minerich’s In Retrospect: The F# in Education Workshop

“I was taking the elevator down after getting settled in my hotel room and as the doors opened I was awestruck by the sight of Don Syme sitting on a couch, typing away on his laptop.”

Stefano Ricciardi’s Project Euler Problem 15 in F#

“With Project Euler Problem 15 we approach the fascinating world of graphs (but, as we shall see, only in a very tangential fashion):”

Ian Voyce’s Beginning F#: Positive Discrimination

“Discriminated unions are one of those things in the lexicon of functional programming that can often sound baffling to “outsiders”; it’s almost up there with monads and currying. But in practice they’re simple and incredibly useful.”

Joel Björnson’s Generalizing formlets (in WebSharper)

“One of the news of WebSharper 2.0 is a redesigned formlet library. For an introduction to WebSharper formlets, see Creating web forms using WebSharper formlets. And for a running example, have a look at this demo.”

Cameron Taggart’s Asynchronous Serial Port Communication with F#

“Below, I show how communicate to a device over a serial port both ways. The advantage of the asynchronous approach is that it does not lock up the user interface if the device does not respond right away.”

A Brief Introduction to F# – MSDN UK Team blog

“Our guest writer for this fortnight’s MSDN Flash is Mark Bloodworth, an Architect Evangelist at Microsoft UK, who kindly offered to write a brief introduction to F#.”

Deen’s Dice’s Coefficient in F#

“A simple short implementation of Dice’s Coefficient in F#. Array.map and Array.fold could be replaced by one function* but I feel its clearer as is.”

Setting the user agent of a Web request

“More and more Websites are denying requests that aren’t sent by recognized browsers and search engines crawlers. This restriction is usually bypassed by setting the user agent string of the request which is possible with the WebRequest and WebClient classes:”

Community

Stack Overflow – F# and Fuzzy Logic

“There are many application of this language, I am going to learn, regarding parsing, functional programming, structured programming… But what about artificial intelligence?”