Partially applied functions
Partially applied functions, as the name suggests, apply the functions partially. It means that for functions with multiple parameters in a parameter list, we don't provide a value for each of the parameters. If we don't want to provide parameters we just leave them blank. Now that we know this, let's look at a similar example to the one we looked at when learning currying. With this, you'll be able to differentiate between the two.
First, take a look at the multiple parameter functions, which we'll convert to partially applied forms:
def makeWebsite(platform: WebsitePlatform, domainName: DomainName, host: Host) = println(s"Making $domainName using $platform with hosting from $host ")
Here, makeWebsite
, as we have already seen, takes three parameters, platform
, domainName
, and host
. Take a look at an application we can create with various intermediate or partially applied functions:
object PaF extends App { type WebsitePlatform = String type DomainName...