From 69aa47454091c0644e4a0a9bc98069498c3830eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=8D=E9=BE=99=E7=BD=97=E6=B1=89?= Date: Fri, 5 Jan 2018 10:47:45 +0800 Subject: [PATCH] Change the type of return value. --- _tour/higher-order-functions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_tour/higher-order-functions.md b/_tour/higher-order-functions.md index ce76323f2f..c2b47097cb 100644 --- a/_tour/higher-order-functions.md +++ b/_tour/higher-order-functions.md @@ -53,7 +53,7 @@ case class WeeklyWeatherForecast(temperatures: Seq[Double]) { private def convertCtoF(temp: Double) = temp * 1.8 + 32 - def forecastInFahrenheit: Double = temperatures.map(convertCtoF) // <-- passing the method convertCtoF + def forecastInFahrenheit: Seq[Double] = temperatures.map(convertCtoF) // <-- passing the method convertCtoF } ``` Here the method `convertCtoF` is passed to forecastInFahrenheit This is possible because the compiler coerces `convertCtoF` to the function `x => convertCtoF(x)` (note: `x` will