"homework" from various scala books, often with variants (yeah, right).