There are a couple of typos and unclarities in exercise 4.x:
4.3:
the text shows that the expected output of the following code should be *abc
:
val starPrefixFn = ::strConcat.curry()("*")
println(starPrefixFn("abc"))
However, the strConcat
is defined with a space so the expected output should be * abc
in 4.4 the class EmailTemplate
inherits from a function so we can use the invoke()
function, but it should be written with the override
keyword as follow:
class EmailTemplate(fileName: String): (Person) -> String {
override fun invoke(aPerson: Person): String = TODO()
}