From e3eebe07f6657c9ade46f7b59748cad8141c5433 Mon Sep 17 00:00:00 2001 From: Julien Richard-Foy Date: Mon, 4 Nov 2019 17:16:45 +0100 Subject: [PATCH] Generalize the syntax of function types Fixes #23 --- .../scala/scalatutorial/sections/HigherOrderFunctions.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/scala/scalatutorial/sections/HigherOrderFunctions.scala b/src/main/scala/scalatutorial/sections/HigherOrderFunctions.scala index 93f7ce62..74a08a9a 100644 --- a/src/main/scala/scalatutorial/sections/HigherOrderFunctions.scala +++ b/src/main/scala/scalatutorial/sections/HigherOrderFunctions.scala @@ -80,6 +80,12 @@ object HigherOrderFunctions extends ScalaTutorialSection { * * So, `Int => Int` is the type of functions that map integers to integers. * + * Similarly, `(A1, A2) => B` is the type of functions that take two arguments + * (of types `A1` and `A2`, respectively) and return a result of type `B`. + * + * More generally, `(A1, ..., An) => B` is the type of functions that take `n` + * arguments (of types `A1` to An`) and return a result of type `B`. + * * = Anonymous Functions = * * Passing functions as parameters leads to the creation of many small functions.