sum = \n -> do var x = 0 for i <- 0 until n: x = x + i return x