Skip to content

{ Monthly Archives } September 2008

Building a Generic Statistics Library, Part 5: Implementation

This post is the last in my series on building a statistics library using Delphi 2009’s new generic types. Having implemented the functions FoldL and Map, and having used FoldL to implement Count and Sum, implementing Average and StandardDeviation are now trivial [...]

Building a Generic Statistics Library, Part 4: Map

It’s been a busy week here in Columbus, what with the highest wind speeds ever recorded in the city and no power in my house — or 1/2 million others — since Sunday.  But don’t feel too bad for me; a lot of people have it worse. Anyway, this will be a fairly short post.
This [...]

Building a Generic Statistics Library, Part 3: Fold

I chose statistical functions as a sample problem because it is so easy to express a statistical function in terms of operations across lists, and operations across lists are what mapping functions do well. In this post, I am going to discuss two list operations, Fold and Map, which will be useful in implementing the Average and StandardDeviation functions. Then I’ll go into some detail about what Fold does and how I use it to compute the sum and count of list elements.

Building a Generic Statistics Library, Part 2: Unit Tests

Since I have a signature, I have enough to start writing unit tests, even without an implementation. Not only does this allow me to check that my implementation works, it’s also a convenient way to run routines in a library-in-progress, without building a "throwaway" user interface.

Building a Generic Statistics Library, Part 1: Interface

In the comments to another post on the subject of Delphi 2009 generics, Raymond asked for an implementation of MapReduce. I thought about how I might demonstrate that in the context of generics, and decided that implementing the higher order functions Fold and Map would be a slightly better demonstration than MapReduce. But since higher order functions can be a pretty abstract concept, I wanted to show an example of how you might use them, so I will use these functions to build a library that does some simple statistical operations, namely, computing the average and the standard deviation of a list of numbers.

Bad Behavior has blocked 713 access attempts in the last 7 days.

Close