Simple, but fun:
def partition[T](items: List[T], p: (T, T) => Boolean): List[List[T]] = {
items.foldRight[List[List[T]]](Nil)((item: T, items: List[List[T]]) => items match {
case (first :: rest) :: last if p (first, item) =>
(List(item)) :: (first :: rest) :: last
case (first :: rest) :: last =>
(item :: first :: rest) :: last
case _ => List(List(item))
})
}
If you understand what this does, or know someone who does, I’m hiring. Send me an e-mail.
Take a look at how Apple would be able to quickly build a large search engine business:
#1 The Apple fanboy market would leave Google in a heartbeat. No question. That’s about 5 per cent of the computer market, and that’s not counting the iPod, iPhone users.
peterfeld:
Lots of competition (“Soak Up The Sun,” holla!), and there are still five months to go, but I’m pretty sure by now it’s safe to give the award to Avril Lavigne for “Girlfriend.”
Disagree!
I nominate the Black Eyed Peas for “My Humps.”
I’m turning 31 so I’m having a karaoke birthday party. The invite is here. If you aren’t already invited it’s either because A) we aren’t facebook friends (in which case lets get that fixed) or B) I screwed up somehow. All are welcome.