Tag Archives: Nerd Club

Fiddling with Functors

Learn you a Haskell continues to bend my mind. This week we were looking at the first half of the chapter on Functors, Applicative Functors and Monoids. I feel I’m following along with the text okay, but just getting brief glimpses at the strange beasts that that lay beneath. While noodling around with one of the examples

ghci> (:) <$> Just 3 <*> Just [4]  
Just [3,4]

I wondered if the type system could infer one of those Justs. Continue reading Fiddling with Functors

Point-free baby-steps in Haskell

we7‘s study group (still aka Nerd Club) has moved onto a bit of Haskell with Learn You a Haskell for Great Good. The chapter on higher order functions introduces this definition:

numLongChains :: Int
numLongChains = length (filter isLong (map chain [1..100]))
    where isLong xs = length xs > 15

For some reason I immediately wanted to factor the thing as a function taking isLong as a parameter: Continue reading Point-free baby-steps in Haskell

Seven Databases: MongoDB and Cities

A few weeks ago the “nerd club” reading group at we7 moved on to Seven Databases in Seven Weeks. It’s a fun book, and I’ve been enjoying working through the exercises. The chapter on MongoDB has an exercise to use the geospatial indexing feature to search for “cities” near London. After a bit of digging and some pretty pictures I discover that things are not quite right with the supplied data.

Continue reading Seven Databases: MongoDB and Cities

On Not Understanding Data Abstraction, Revisited

We have a technical reading group (aka ‘Nerd Club’) at work. Last week we tackled the paper On Understanding Data Abstraction, Revisited by William Cook. We learned about it through a talk by Kevlin Henney that takes its title from a clause in the paper: It Is Possible to Do Object-Oriented Programming in Java. I really enjoyed reading the paper, but fear I’ve failed to understand important parts of it. Failing to understand isn’t so unusual for me, particularly for papers that have more than a tiny bit of theory, but this one has me frustrated because I’m sure I’m close.

The paper shows that there are two common forms of data abstraction, abstract data types (ADTs) and objects, and that they are different and complementary. The final sentence reads:

Understanding the fundamental differences between objects and ADTs can help in choosing to use them wisely.

and so my goal is to understand those fundamental differences. The paper first characterises the two kinds of abstraction somewhat theoretically, and then talks about their implementation in practical programming languages: Java, Haskell and Smalltalk.

What I understood

I haven’t totally failed to understand. It’s a good paper and there’s loads of great stuff that I can say I got:

Continue reading On Not Understanding Data Abstraction, Revisited