Some fun with generic algorithms.