Quick sort implemented with functional language