Matthew Podwysocki's Blog

Architect, Develop, Inspire...

  • Functional C# – Forward Functional Composition

    In the last post, we talked about partial application and currying with respect to functional composition.  I showed the power of functional composition in regards to a real-world example of how to calculate a book price given the chain of potential discounts, taxes, shipping, etc.  Through functional composition, we are able to add additional calculations with relative ease.  In today’s example, let’s revisit some of those topics and explore some areas I haven’t touched yet.

  • Functional C# – Composing Through Partial Application

    Earlier this week, I was challenged on Twitter to give a practical example of currying in C#.  This was a great question, because outside of the normal add and multiply people tend to do, there isn’t much out there.  This was also a question brought up as I spoke at the Philly.NET Code Camp this past weekend as well about good practical examples.  In this post, I hope to use one example that I used during my talk on Functional Programming at the Continuous Improvement in Software Conference in Austin last October. 

  • [ANN] DC ALT.NET (4/29/2009) – Refactoring with George Dinwiddie

    Continuing with our back to basics series which started last month with an introduction to Test Driven Development, this month we are covering Refactoring.  The discussion will be led by George Dinwiddie, a software development consultant, coach and a found of Agile Maryland and the Maryland Chapter of the APLN and we’re lucky to have him.  As with before, these are quite interactive discussions, so participation is highly encouraged.  

  • Functional Solution for the Shortest Path Problem

    As part of my dive into the Collective Intelligence series, I’ve found myself many times taking code that was written in an imperative coding style and moving it towards a pure functional style with immutable data structures instead of ones, the application of functions instead of for loops (which is an upcoming post), and the elimination of state.  This was also a major part of my talk this past weekend at the Philly.NET code camp on Functional Programming in .NET.

  • Haskell and Collective Intelligence

    Tonight for the Real World Haskell Book Club, Paul Barry and I decided to dig through the Programming Collective Intelligence book as some good hack projects as we dive deep into the language features.  As you may have noticed both here on my blog and on Twitter, I have been posting a lot of these samples in F# and refactoring along the way.  By taking the Python code and rewriting it in Haskell gave me better insight into the Haskell way, but also refactoring opportunities for my existing F# code.

  • From Imperative to Functional – Transposing Maps

    In my recent adventures around Collective Intelligence, I took many code samples that have been written in an imperative coding style and moved them to a more functional style.  With this move sometimes brings some leaps in thinking in which you have to step back and break down the problem into smaller parts and come at it from a different direction.  Today, I’ll go over two examples in which we’re going to transpose a map from an imperative style using mutable dictionaries to one that is written in a functional style with immutable maps.  There is a lot of focus on this blog around immutability and functional composition as they are key to functional programming.

  • Functional Programming and Collective Intelligence - III

    Previously, I went over some formulas on how we can calculate the similarity between our items using the Manhattan Distance, Chebyshev Distance and the Jaccard Coefficient.  Then we were able to plug in our given similarity function to another function which then gets the top matches for our given preferences.  This time, instead of determining which critic is more suited to my tastes, instead, we could instead rate which items should be viewed.

  • Functional Programming and Collective Intelligence - II

    In the previous post covering Functional Programming and Collective Intelligence, I left off with the discussion of the two different algorithms for measuring similarity, the Euclidean Distance and the Pearson product-moment correlation coefficient.  The Programming Collective Intelligence covers these two formulas in depth, yet they are not the only two that are capable of performing the task.  Let’s briefly cover some more of those before moving onto ranking the critics and recommending items for a particular user.

  • Functional Programming and Collective Intelligence

    During some of my talks about functional programming, and in turn, F#, many do ask “Why Functional Programming?” and “Why use F#?” and both are very good questions.  Many of the people using F# today are in fields such as finance, insurance, science and academia.  Today, I hope to dive into a subject for which it is well suited.  If you’ve been following me on Twitter, I’ve been talking a bit and showing off a bit of code on today’s subject.