{"id":306191,"date":"2010-04-13T21:45:02","date_gmt":"2010-04-14T04:45:02","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/research\/?p=306191"},"modified":"2016-10-16T10:44:36","modified_gmt":"2016-10-16T17:44:36","slug":"f-putting-fun-functional","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-us\/research\/blog\/f-putting-fun-functional\/","title":{"rendered":"F#: Putting the \u2018Fun\u2019 into \u2018Functional\u2019"},"content":{"rendered":"<p><em>By Rob Knies, Managing Editor, Microsoft Research<\/em><\/p>\n<p>You would be forgiven if you thought the \u201cF\u201d in F#\u2014which <a class=\"msr-external-link glyph-append glyph-append-open-in-new-tab glyph-append-xsmall\" rel=\"noopener noreferrer\" href=\"http:\/\/blogs.msdn.com\/dsyme\/archive\/2009\/05\/20\/visual-studio-2010-beta1-with-f-is-now-available-plus-matching-f-ctp-update-for-vs2008.aspx\" target=\"_blank\">made its debut<span class=\"sr-only\"> (opens in new tab)<\/span><\/a> as part of <a class=\"msr-external-link glyph-append glyph-append-open-in-new-tab glyph-append-xsmall\" rel=\"noopener noreferrer\" href=\"https:\/\/www.visualstudio.com\/\" target=\"_blank\">Visual Studio 2010<span class=\"sr-only\"> (opens in new tab)<\/span><\/a> on April 12\u2014stands for \u201cfunctional.\u201d<\/p>\n<p>After all, <a href=\"https:\/\/www.microsoft.com\/en-us\/research\/project\/f-at-microsoft-research\/\" target=\"_blank\">F#<\/a>\u2014pronounced \u201cF sharp\u201d\u2014is a functional programming language for the .NET Framework that combines the succinct, expressive, and compositional style of functional programming with the runtime, libraries, interoperability, and object model of .NET.<\/p>\n<div id=\"attachment_306197\" style=\"width: 200px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-306197\" class=\"size-full wp-image-306197\" src=\"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2010\/04\/Don-Syme.jpg\" alt=\"Don Syme\" width=\"190\" height=\"250\" \/><p id=\"caption-attachment-306197\" class=\"wp-caption-text\">Don Syme<\/p><\/div>\n<p>But <a href=\"https:\/\/www.microsoft.com\/en-us\/research\/people\/dsyme\/\" target=\"_blank\">Don Syme<\/a>, inventor of F# and leader of the team that incubated the language, has a different, truncated, and entirely whimsical definition.<\/p>\n<p>\u201cIn the F# team,\u201d says Syme, a principal researcher at <a href=\"https:\/\/www.microsoft.com\/en-us\/research\/lab\/microsoft-research-cambridge\/\" target=\"_blank\">Microsoft Research Cambridge<\/a>, \u201cWe say, \u2018F is for Fun.\u2019<\/p>\n<p>\u201cF# enables users to write simple code to solve complex problems. Programming with F# really does make many programming tasks simpler, and our users have consistently reported that they\u2019ve found using the language enjoyable.\u201d<\/p>\n<p>Indeed, F#, which has been developed in a partnership between Microsoft Research and the Microsoft Developer Division, is already popular with the .NET developer community. The language is widely known in the academic community and among thought leaders, and the list of admirers will only increase as Visual F#, the result of a partnership between Microsoft Research Cambridge and Microsoft\u2019s Developer Division, becomes a first-class language in Visual Studio 2010.<\/p>\n<p>\u201cF# brings a really practical and productive functional-programming language into the suite of languages that Visual Studio and .NET developers have available to them,\u201d says Luke Hoban, senior program manager for Microsoft\u2019s Visual Studio Managed Languages team. \u201cF# provides new tools for existing Visual Studio developers and extends the reach of Visual Studio to new audiences.<\/p>\n<p>\u201cFunctional programming offers important new ways to think about problem solving. The F# Interactive lets developers work interactively with data and application-programming interfaces [APIs] in a lightweight, explorative environment. F# also provides a set of core features for making parallel and asynchronous programming easier.\u201d<\/p>\n<p>The language enables explorative programming, with the flexibility to translate requirements into code easily. That ability makes F# particularly valuable for the technical, algorithmic, parallel, and data-rich fields, with applications ranging from financial-market analysis to machine learning and from <a href=\"https:\/\/www.microsoft.com\/en-us\/research\/f-officially-joins-visual-studio\/\" target=\"_blank\">scientific usage<\/a> to game development.<\/p>\n<p>Such versatility delights Andrew Herbert, Microsoft distinguished engineer and managing director of Microsoft Research Cambridge. But he\u2019s not surprised.<\/p>\n<p>\u201cOver the years,\u201d Herbert says, \u201cDon has been a significant contributor to Visual Studio, being one of the Cambridge team that did the early work putting key features like generic functions in the .NET runtime.<\/p>\n<p>\u201cI am immensely proud of this achievement.\u201d<\/p>\n<p>Syme, of course, is in better position than anyone to provide a detailed definition of his language\u2014and the benefits it has to offer.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-306200\" src=\"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2010\/04\/Visual-F.jpg\" alt=\"Microsoft Visual F#\" width=\"360\" height=\"216\" srcset=\"https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2010\/04\/Visual-F.jpg 360w, https:\/\/www.microsoft.com\/en-us\/research\/wp-content\/uploads\/2010\/04\/Visual-F-300x180.jpg 300w\" sizes=\"auto, (max-width: 360px) 100vw, 360px\" \/>\u201cF# is a simple, succinct, efficient functional programming language for .NET that lets users concentrate on the problems they are solving rather than getting lost in programming details,\u201d he says. \u201cIts succinct syntax and powerful type inference lets users stay closer to the domain they are working in, and the integration into .NET and Visual Studio gives rich access to the expansive .NET platform.<\/p>\n<p>\u201cF# has strong support for parallelism and concurrency, through its support for immutability and asynchronous programming, and tools such as F# Interactive enable exploring data interactively, analyzing, visualizing, and testing against live data sources. This interactive development then scales directly up to full .NET component development, without having to rewrite code. F# has established itself as an innovative language on the .NET platform, and many developers have been attracted by looking for interesting new language options when working on .NET.\u201d<\/p>\n<p>Visual Studio 2010 includes the 2.0 version of F#\u2014the first supported, product-quality release. This will enable usage by a broader set of developers, and the language benefits from Visual Studio debugging and compiling capabilities.<\/p>\n<p>The Visual Studio release includes important new features of F#:<\/p>\n<ul>\n<li>A simple, succinct functional syntax.<\/li>\n<li>A rich .NET object-oriented programming model.<\/li>\n<li>Integrated parallel and asynchronous programming features.<\/li>\n<li>Units of measure.<\/li>\n<li>F# Interactive.<\/li>\n<\/ul>\n<p>\u201cA programming language takes several years to mature,\u201d Syme says, \u201cand this is what we\u2019ve been doing from 2005 to 2009. This has resulted in a highly stable, efficient, and powerful language, available both as freely usable standalone tools, including visual editing tools, and also as part of Visual Studio 2010. We now have a powerful and stable base functional language and library for use in professional development contexts\u2014a wonderful result.\u201d<\/p>\n<p>A functional programming language such as F#\u2014which can be used on varied platforms, such as Mac and Linux, in addition to Windows\u2014provides a tool bag of functions from which users can pick to solve their problems. Such languages operate on a higher level, and this abstraction of functionality from coding is a big benefit in certain domains. That\u2019s what led Syme and colleagues to the F# project.<\/p>\n<p>\u201cFunctional languages attract me because of their simplicity even when solving complex tasks,\u201d Syme says. \u201cA good functional program is like a beautiful poem: You see the pieces of a solution come together.\u201d<\/p>\n<p>Work on this particular verse began seven years ago, when he identified a need for a functional programming language that integrated seamlessly with the .NET platform.<\/p>\n<p>\u201cMy research vision is about making typed functional programming work in practice,\u201d Syme explains. \u201cStrong typing is a wonderful thing: It makes your code more robust, it helps you understand and navigate complex objects, and it allows a visual environment to inform you when you make basic mistakes. And functional programming offers really powerful tools to simplify a huge range of programming tasks. But traditionally, it\u2019s been hard to deliver these to practicing programmers without losing something big, such as succinctness or objects.<\/p>\n<p>\u201cF# solves the questions of typed functional programming on the .NET platform. Along with features such as C# and .NET generics, which I\u2019ve also worked on, it fulfills this vision. But further than that, it also opens new research questions, as we continue to seek to simplify complex problems using programming techniques.\u201d<\/p>\n<p>The core syntax of F# follows in the tradition of ML programming languages, in particular, OCaml, and the language also incorporates key ideas from such languages as C#, Haskell, and Python. F# continues a long tradition of research and development by starting with the design of core ML and building atop it.<\/p>\n<h2>\u2018Independent Identity\u2019<\/h2>\n<p>\u201cF# started in 2003 as a project to ensure that typed functional programming in the spirit of OCaml found a high-quality expression on the .NET Framework,\u201d Syme recalls. \u201cThese languages excel in tasks such as data transformations and parallel programming, as well as general-purpose programming. Over time, F# has incorporated elements from other languages, too, and carved out an independent identity as a mixed object\/functional language on .NET. The journey to create F# let us engage with top language designers from around the world\u2014and with real programmers tackling hard problems.\u201d<\/p>\n<p>Those programmers represent a number of industry verticals, which are finding the language helpful for algorithmic analysis of large quantities of business information. Whether it be financial-market analysis, retail, scientific applications, or business-information management, F# makes it easy for analysts to experiment with different data and algorithms to obtain additional quality.<\/p>\n<p>\u201cF# gets used for all sorts of things,\u201d Syme confirms. \u201cWe\u2019ve seen a lot of interest and uptake from the financial community, where typed functional programming serves as a wonderful basis for data analytics and where questions of parallelism and efficient programming are very real. We\u2019ve also seen fantastic applications in server-side data analysis, including in parts of the <a class=\"msr-external-link glyph-append glyph-append-open-in-new-tab glyph-append-xsmall\" rel=\"noopener noreferrer\" href=\"http:\/\/www.bing.com\/\" target=\"_blank\">Bing<span class=\"sr-only\"> (opens in new tab)<\/span><\/a> ad delivery and analysis pipeline. F# seems a particularly good language for programmatic machine learning.<\/p>\n<p>\u201cF# scripting also makes F# ideal as a way to explore software components, develop algorithms, and investigate solutions to problems.\u201d<\/p>\n<p>But don\u2019t get the idea that F# will be replacing C# as the predominant .NET language for professional developers. F# is complementary to .NET stalwarts C# and Visual Basic .NET, which remain integral to the majority of .NET projects. But C# and Visual Basic programmers can use F# components in their existing applications, enabling developers to maintain their current investments and integrate F# on a component-by-component basis.<\/p>\n<p>Throughout the project that led to F# taking its place as a major .NET programming language, the goals have remained consistent: to combine the power and simplicity of functional programming with the tools, libraries, performance, and interoperability of .NET.<\/p>\n<p>\u201cThis combination,\u201d Syme enthuses, \u201cis a match made in heaven, giving a synthesis of programming style and platform. We want to revolutionize how people think about programming and equip programmers in domains such as technical computing with tools to solve their problems.\u201d<\/p>\n<h2>Team Effort<\/h2>\n<p>The F# team currently includes approximately 12 contributors. Syme credits Hoban as an integral player for \u201chis grasp of what makes for successful language development\u2014for everything from simplicity in an API design to pushing the boundaries with what can be done with the language.\u201d<\/p>\n<p>\u201cIn many ways,\u201d Syme adds, \u201cF# 2.0 represents the successful transfer of three independent major research results into product form. First, we have F# itself, developed by me with the assistance of James Margetson. Next, Andrew Kennedy has contributed the design and implementation of units of measure in F#, a direct transfer of the beautiful ideas from his research work. Finally, F# parallel and asynchronous programming has been influenced by many people, including <a href=\"https:\/\/www.microsoft.com\/en-us\/research\/people\/simonpj\/\" target=\"_blank\">Simon Peyton-Jones<\/a>. I\u2019ve been very grateful for his comments and support.\u201d<\/p>\n<p>Others who have supplied invaluable support include Martin Odersky, designer of the functional language Scala and a professor at \u00c9cole Polytechnique F\u00e9d\u00e9rale de Lausanne, the Swiss Federal Institute of Technology in Lausanne, who hosted a visit by Syme during which key concepts behind F# came into focus; Ralf Herbrich, one of a number of colleagues who have applied F# within Microsoft Research; and <a class=\"msr-external-link glyph-append glyph-append-open-in-new-tab glyph-append-xsmall\" rel=\"noopener noreferrer\" href=\"http:\/\/www.tomasp.net\/\" target=\"_blank\">Tom\u00e1\u0161 Pet\u0159\u00ed\u010dek<span class=\"sr-only\"> (opens in new tab)<\/span><\/a>, a former Microsoft Research intern and co-author of <em>Real World Functional Programming: With Examples in F# and C#<\/em>, which Syme terms \u201cone of the best books on applied functional programming.\u201d<\/p>\n<p>Syme also emphasizes the importance of Microsoft Research itself in the development of the language.<\/p>\n<p>\u201cMicrosoft Research has given F# a long-term home,\u201d he says, \u201cwhich has allowed the language to mature in a context of intellectual curiosity and investigation. It&#8217;s also given us access to many of the best researchers in the world. The partnership we&#8217;ve developed with the Microsoft Developer Division is something we very much look forward to continuing.\u201d<\/p>\n<h2>Problem Solving<\/h2>\n<p>Along the way, the F# effort encountered and surpassed a series of hurdles.<\/p>\n<p>\u201cCombining object-oriented and functional programming poses several challenges,\u201d Syme says, \u201cfrom surface syntax to type inference to design techniques. I\u2019m very proud of how we\u2019ve addressed those problems. F# also has a feature called \u2018computation expressions,\u2019 and we\u2019re particularly happy with the unity we\u2019ve achieved there.\u201d<\/p>\n<p>Now, with F# having been added to the Visual Studio tool kit, it\u2019s time for the team to turn to new challenges, right? Not so fast, Syme cautions.<\/p>\n<p>\u201cA recurring theme of F# is its focus on accessing information from outside the language,\u201d he states. \u201cLooking ahead, we want to continue to connect F# to rich data sources and external sources of functionality. There is a tendency in the industry to think that strong typing and navigability are necessarily lost around the fringes of an application. In many ways, C# and F# already dispel this myth. However, we have ideas about how to make external access even simpler and more intuitive, continuing to break new ground for typed languages.\u201d<\/p>\n<p>Meanwhile, on the product side, it will be interesting, Hoban says, to watch how F# is embraced now that it has received official release as part of Visual Studio 2010.<\/p>\n<p>\u201cWe\u2019ve seen a number of interesting uses across a broad range of software applications,\u201d he says. \u201cWe\u2019re also seeing many examples of F# being used to build components of larger .NET applications. This allows projects to seamlessly integrate F# in areas where it provides significant value without needing to change anything else in their applications.\u201d<\/p>\n<p>For Syme, staunch advocate of functional programming and making software development enjoyable, the prospect of people enjoying their work with F# is the ultimate reward.<\/p>\n<p>\u201cThat,\u201d he says, \u201cmakes me happy.\u201d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Rob Knies, Managing Editor, Microsoft Research You would be forgiven if you thought the \u201cF\u201d in F#\u2014which made its debut as part of Visual Studio 2010 on April 12\u2014stands for \u201cfunctional.\u201d After all, F#\u2014pronounced \u201cF sharp\u201d\u2014is a functional programming language for the .NET Framework that combines the succinct, expressive, and compositional style of functional [&hellip;]<\/p>\n","protected":false},"author":39507,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"msr-url-field":"","msr-podcast-episode":"","msrModifiedDate":"","msrModifiedDateEnabled":false,"ep_exclude_from_search":false,"_classifai_error":"","msr-author-ordering":[],"msr_hide_image_in_river":0,"footnotes":""},"categories":[194488],"tags":[194493,195378,193543,214589,214583,214586,187067],"research-area":[13560],"msr-region":[],"msr-event-type":[],"msr-locale":[268875],"msr-post-option":[],"msr-impact-theme":[],"msr-promo-type":[],"msr-podcast-series":[],"class_list":["post-306191","post","type-post","status-publish","format-standard","hentry","category-program-languages-and-software-engineering","tag-net-framework","tag-don-syme","tag-f","tag-functional-programming-language","tag-microsoft-developer-division","tag-visual-f","tag-visual-studio","msr-research-area-programming-languages-software-engineering","msr-locale-en_us"],"msr_event_details":{"start":"","end":"","location":""},"podcast_url":"","podcast_episode":"","msr_research_lab":[199561],"msr_impact_theme":[],"related-publications":[],"related-downloads":[],"related-videos":[],"related-academic-programs":[],"related-groups":[],"related-projects":[171037,171032],"related-events":[],"related-researchers":[],"msr_type":"Post","byline":"","formattedDate":"April 13, 2010","formattedExcerpt":"By Rob Knies, Managing Editor, Microsoft Research You would be forgiven if you thought the \u201cF\u201d in F#\u2014which made its debut as part of Visual Studio 2010 on April 12\u2014stands for \u201cfunctional.\u201d After all, F#\u2014pronounced \u201cF sharp\u201d\u2014is a functional programming language for the .NET Framework&hellip;","locale":{"slug":"en_us","name":"English","native":"","english":"English"},"_links":{"self":[{"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/posts\/306191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/users\/39507"}],"replies":[{"embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/comments?post=306191"}],"version-history":[{"count":4,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/posts\/306191\/revisions"}],"predecessor-version":[{"id":306215,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/posts\/306191\/revisions\/306215"}],"wp:attachment":[{"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/media?parent=306191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/categories?post=306191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/tags?post=306191"},{"taxonomy":"msr-research-area","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/research-area?post=306191"},{"taxonomy":"msr-region","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-region?post=306191"},{"taxonomy":"msr-event-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-event-type?post=306191"},{"taxonomy":"msr-locale","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-locale?post=306191"},{"taxonomy":"msr-post-option","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-post-option?post=306191"},{"taxonomy":"msr-impact-theme","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-impact-theme?post=306191"},{"taxonomy":"msr-promo-type","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-promo-type?post=306191"},{"taxonomy":"msr-podcast-series","embeddable":true,"href":"https:\/\/www.microsoft.com\/en-us\/research\/wp-json\/wp\/v2\/msr-podcast-series?post=306191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}