October 2009
4 posts
2 tags
Lift Off
I arrived at the FGM building by way of my couchsurfing host, Jenny. At the moment, Reston looks a bit like London (at least if you look straight up). Fall has painted the leaves brilliantly, a sight I’m left wanting in Florida. Jenny graciously dropped me off at the FGM building on her way to school (she’s a school teacher). I gladly accepted arriving an hour early for a free ride,...
Oct 30th
2 tags
Functional Content Negotiation in Scala
Today I needed some code to assess if an HTTP request matched certain criteria, based on its declared content type. Essentially, I needed to know if the user-agent wanted XML (or JSON), and that it wanted only that type. Requirements: Check the Accept request header for a given content type. Support a non-standard X-Accept header serving the same purpose as Accept (IE doesn’t let...
Oct 16th
2 tags
“Great minds discuss ideas; Average minds discuss events; Small minds discuss...”
– Eleanor Roosevelt
Oct 13th
3 notes
2 tags
A Solution to the Set Combinations Problem
def combine[T](sets: List[List[T]]): List[List[T]] = sets match { case List(l1, l2) => l1.flatMap(i1 => l2.map(List(i1, _))) case head :: tail => combine(tail).flatMap(set => head.map(_ :: set)) case _ => sets }
Oct 13th