Chris Smith's completely unique view

Algorithms, functional programming, CLR 4.0, and of course, F#!

Blog - About

About Chris Smith's completely unique view

Chris works as a Software Design Engineer in Test at Microsoft, where he spends his time making sure F# is the most awesome programming language ever.

  • Chris Smith's completely unique view

    F# in 20 Minutes – Part II

    • 16 Comments
    Now that we have covered the basics, in minutes 8 - 14 we will cover the foundational concepts and types in F#. By the end of Part II you should be able to read F# code reasonably well. Immutability You may have noticed that I’ve been using the...
  • Chris Smith's completely unique view

    F# in 20 Minutes - Part I

    • 66 Comments
    Edit: If you are interested in learning F#, let me take the opportunity to provide a shameless plug for my book Programming F# . Edit: Updated for the September CTP. Edit: While I certainly encourage you to read my blog, there is a great video we...
  • Chris Smith's completely unique view

    Sieve of Eratosthenes in F#

    • 3 Comments
    If you don’t know what the Sieve of Eratosthenes is, don’t worry because a few days ago neither did I. But in short it is a very simple way to calculate prime numbers. Essentially you loop through all integers and keep a list of numbers which are known...
  • Chris Smith's completely unique view

    Windows Live Writer

    • 4 Comments
    So I figured I’d check out Windows Live Writer and see what all the buzz is about. Update: With a plugin I can now copy from Visual Studio, huzzah! Con – Doesn’t preserve syntax highlighting when copying from Visual Studio. Pro – With This Plug...
  • Chris Smith's completely unique view

    A Java to x86 compiler written in F#

    • 9 Comments
    A little personal information about me, I’m currently working on a masters degree at the University of Washington. And a few weeks ago I completed taking a course in Compiler Construction , where the course project was to build a simple Java compiler...
  • Chris Smith's completely unique view

    Project Euler - Problem 34

    • 6 Comments
    Edit 2/8/2010: Updating for recent F# language changes. In our continuing series of how to solve Project Euler problems easily with F#, we now arrive at problem 34 which is defined as: 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 ...
  • Chris Smith's completely unique view

    Shameless plug - we're hiring!

    • 1 Comments
    As Don and Brian have mentioned, we are working towards an April Update to the F# research release as well CTP this summer and eventually integrating into the next release of Visual Studio. Things are going great on the polishing/finalizing F# front,...
  • Chris Smith's completely unique view

    Single-case Active Patterns vs Function Calls

    • 0 Comments
    In response to an earlier post a reader wrote: Sent From: namin Subject: (|EnsurePrefix|) -- why is it an active pattern? __________________________________ Hi Chris, I was reading your blog entry Regular Expressions via Active Patterns and...
  • Chris Smith's completely unique view

    How not to reverse a list

    • 0 Comments
    Brian McNamara, the latest addition to our stellar F# dev team, wrote up a great blog post on some pitfalls of F#. Specifically, how if you aren't careful something as simple as reversing the items in a list can take on order O(N^2) time and potentially...
  • Chris Smith's completely unique view

    Project Euler - Problem 24

    • 2 Comments
    Project Euler problem 24 in F# Problem 24 is defined as: A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically...
  • Chris Smith's completely unique view

    How to debug compiler generated code

    • 2 Comments
    Edit 2/8/2010: Update for recent F# language changes James Margetson recently showed me a great tip for debugging compiler generated code. Typically the problem is that using the Visual Studio debugger all you see is the x86 disassembly of the JIT...
  • Chris Smith's completely unique view

    Project Euler - Problem 19

    • 1 Comments
    I haven't been to Project Euler in a while, but since I'm seeing other F# folks are getting into it, I figured I'd help work to improve the average F# 'genus rating' on the site. (Currently at 11%.) The easiest one I haven't already solved is problem...
  • Chris Smith's completely unique view

    How not to name types and identifiers

    • 0 Comments
    From the 'code which is valid but looks strange and might be removed in the next release of F#, but isn't a big deal anyways' department: Adding managed, generic .Net names as part of the inference proceedure process. #light open System.Collections...
  • Chris Smith's completely unique view

    Regular Expressions via Active Patterns

    • 4 Comments
    In my last post I introduced Active Patterns. Sure they seem neat, but what do you actually do with them?. This post coverage how to leverage Active Patterns to make your code simpler and easier to understand. In particular, how you can use Regular Expressions in Active Patterns....
  • Chris Smith's completely unique view

    Introduction to F# Active Patterns

    • 4 Comments
    You may have heard of Active Patterns before – typically in conjunction with the words ‘awesome’ or ‘amazing’. Active Patterns are one of the more unique language features in F# and once you get a good feel for them one of the most powerful. This post will demonstrate Active Patterns from single-case and multi-case to partial and parameterized. If it’s called an Active Pattern, you’ll see an example in this post. So let’s get started....
  • Chris Smith's completely unique view

    Pattern matching snippets

    • 3 Comments
    I've written up a few snippets demonstrating F# pattern matching....
  • Chris Smith's completely unique view

    fsyacc Sample on Code Gallery

    • 1 Comments
    The first release is a simple four function calculator, which builds off of last week's blog post and integrates fsyacc for parsing. The net result is the ability to write simple simple expressions like "10 * 2 - 15 / 3" and get it evaluated using the order of operations....
  • Chris Smith's completely unique view

    fslex Sample

    • 5 Comments
    In this post I’ll focus on creating a simple program which will take advantage of fslex, and show how to generate a scanner to parse basic mathematical expressions like “1.0 / (sin pi + cos pi)”....
  • Chris Smith's completely unique view

    F# Snippet - Enums and Discriminated Unions

    • 1 Comments
    I was writing some F# code this week and ran into problem. Consider the following code: type Thingey = This | That | SomethingElse Which looks like an enum. So I assumed that, like things inheriting from System.Enum, an instance of the type had a ToString method which did the right thing. But, alas, when I type it into the F# Interactive Console I get: > (Thingey.That).ToString();; val it : string = "FSI_0002+Thingey" The reason being is that the type Thingey is actually a Discriminated Union. In F#, to produce an Enumeration type you use the same syntax except you must explicitly provide an integer value for each member. Discriminated Unions can do a lot more than Enums in F#, but there are situations in which to use both. The following snippet shows you how to use Enums and simple Discriminated Union types in F#....
  • Chris Smith's completely unique view

    F# and Markov Chains, oh my!

    • 2 Comments
    Recently I started playing a collectable card game after some friends got me into it. (Who themselves got back into it after some friends of theirs started playing. Witness the economic potential of viral card games!) As it turns out, I am a pretty poor card player I figured I would get into the business of collecting cards. Which is fun, you can do alone, and requires no skill. I figured I would answer the question “If I started from scratch, how many booster packs would it take for me to collect the whole set”. Well, since booster packs give you cards randomly the best you can shoot for is a confidence interval. ...
  • Chris Smith's completely unique view

    F# Snippets 01

    • 6 Comments
    This week I had the pleasure of writing some of our test automation infrastructure in F#. Not only does this give us a chance to dogfood the language, but it also helps us find pain points in the developer experience. For me at least, the biggest pain point right now is a lack of F# examples surrounding core syntax. But I would like to help combat this, so I've written a very simple app to show how to do basic object inheritance as well as implement an interface....
  • Chris Smith's completely unique view

    Project Euler in F# - Problem 23

    • 1 Comments
    Here is a quick write-up on how to solve Project Euler’s Problem 23 in F#......
  • Chris Smith's completely unique view

    Joining the F# team

    • 2 Comments
    I'm please to announce that starting Monday I'll be joining the F# team as (currently) the only full-time tester. I'm super-excited about this for many reasons, but the biggest is knowing what an impact I'll have. Without a doubt F# will change the .Net landscape by reaching out to a new breed developer and enabling new scenarios. As we evolve the language into a v1.0 form and build out the first set of core libraries I think people will be pleasantly surprised by the power and elegance of F#....
  • Chris Smith's completely unique view

    Project Euler in F# - Problem 5

    • 6 Comments
    Here is a quick write-up on how to solve Project Euler’s Problem 5 in F#....
  • Chris Smith's completely unique view

    Project Euler in F# - Problem 2

    • 6 Comments
    It’s been a few days, so here is Project Euler’s problem 2 in F#. Problem 2 is defined as follows: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... Find the sum of all the even-valued terms in the sequence which do not exceed one million. Sounds simple enough, here’s my Solution in F#......
Page 3 of 7 (154 items) 12345»