Matthew Podwysocki's Blog

Architect, Develop, Inspire...

  • F# and the Dynamic Lookup Operator ala C#

    In the previous post, we covered various scenarios around how we’d make the syntax around using the MongoDB C# Driver a little nicer and less stringy.  And before that we looked at using and abusing these so called dynamic lookup operators.  In the F# language, we have the ability to define two “dynamic” operators, a get member operator denoted by the ( ? ), and the set member operator denoted by the ( ?<- ).  The F# language and its associated libraries do not have an actual implementation of these operators, but instead allow you to implement them as you see fit.  Previously, we tried two approaches…

  • Exploring MongoDB with F#

    If you’ve been following me on Twitter, I’ve been digging a bit into MongoDB.  When I was involved with the planning of NoSQLEast this past year, I sat down and used it in anger and was quite pleased with the results.  Using it with a language which allows for quick prototyping such as F# has afforded me to get up and going on a project with very little effort.  At some point, I don’t want to be bothered with having to go into another tool, create a schema, decide what data types, run migrations and all the fun things that come along with traditional RDBMS solutions. I just want a quick answer with the data I have.  There was one issue of course that nagged me which was the ubiquitous use of strings for everything from databases, collections, and keys.  With a language such as F#, could we do any better than this approach?

  • Using and Abusing the F# Dynamic Lookup Operator

    Lately, I’ve been playing with such things as MongoDB using F# to rapidly prototype ideas.  With that, I’ve tried to rid myself of magic strings by using the F# dynamic lookup operator.  I’ll cover exactly what I’m doing in the next post when using MongoDB, but in this post I’d like to explore a little of what you could do with a little noticed dynamic lookup operator in F#.

  • A Kick in the Monads – Creating Extended Builders Part III

    So far in this series, we’ve covered some of the methods you can implement for custom computation expressions (aka Monads) in F# such as bind and return, as well as exception and resource management.  For the last part in the series, we’ll take a look at looping constructs.  As we know, F# is a pragmatic multi-paradigm language which supports not only functional features, but imperative ones as well, which include mutability, looping constructs and so on.  Just as regular F# supports for and while loops, we have the ability to take advantage of them as well inside of our computation expressions by implementing two methods.  Let’s start with the while loop.

  • Much Ado About Monads – Creating Extended Builders Part II

    In this series, we’ve looked custom computation expressions, what they are, how they are applicable to development and how we might implement them in F#.  In the previous post, we went over some of the basic methods you can include on your custom computation expression to allow for a more rich programmatic model than the linear style provided via both Bind and Return.

  • Much Ado About Monads – Creating Extended Builders

    In the past two posts in this series, we’ve covered both the State Monad and Reader Monad, not only the motivations, but how you would implement them in F#.  With defining the Return and Bind methods on our computation expression builders, we’re able to do composable linear programming.  But, what we lack is an imperative programming model on top to allow for such things as if statements, for and while loops, and try/catch or try/finally blocks.  Luckily, there is a programmatic model to follow to make these things possible inside of our expressions.  Let’s cover each of these functions in turn and see what each one does and in the process implement them for the Reader Monad.

  • [ANN] DC ALT.NET – 1/27/2010 - Clojure

    The next meeting of DC ALT.NET will be held on January 27th from 7-9PM on Clojure with Craig Andera.  Previously, he gave a talk about spending some time in Common Lisp and some of the lessons learned during his adventures.  You may have noticed a lot of talk around this language, especially in the Java community.  Where trends are concerned, momentum has shifted from Groovy to Scala and now to Clojure just in terms of sheer interest.  It’s one that’s on the top of my list to dive deep into this year.  So, what is it and what should we care?

  • Much Ado About Monads – Reader Edition

    In the previous post, we talked a bit about the State Monad, what it is and how you could use it today in your F# application.  But, with any new piece of information such as this, it should be taken in context, and there are other patterns as well when dealing with a multi-paradigm language such as F#.  We also talked about how the State Monad might not have been the best choice for modeling our web scripting DSL as our browser state is encapsulated in the Browser class, and once it is set, it doesn’t change.  With that, we could turn our eyes to using the Reader Monad as we read from our environment.

  • Much Ado About Monads – State Edition

    Over the past year, I’ve had the opportunity to be a technical reviewer of a number of books including Chris Smith’s Programming F# book.  During my recent trips, I had the chance to sit down and read through the book once again, and in particular Chapter 10 on Computation Expressions (aka Monads).  A section worth noting in here is the use of the State Monad in order to create a library for web scripting.  In the past, I’ve had a series on Much Ado About Monads where I look at the basic Monads such as Maybe and List, but this time, let’s look at what we can do with the State Monad.