2016-12-05 13 views
0

在111頁中,映射法則原因如下圖所示:什麼映射法平均(Scala的功能編程)

  • 線路1:map(unit(x))(f) == unit(f(x))
  • 線路2:map(unit(x))(id) == unit(id(x))
  • 3號線:map(unit(x))(id) == unit(x)
  • 線路4:map(y)(id) == y

什麼讓我困惑的是躍遷從2號線到3號線,似乎我錯過了一些東西,有人可以幫助嗎?

回答

3

是這樣工作的,因爲id(x) == x,所以:

map(unit(x))(id) == unit(id(x)) == unit(x)

+0

爲什麼ID(X)== X? id在這裏意味着什麼? – zcbzfl

+0

'id'是一個標識函數,返回的值與給定的值完全相同,例如'id(5)== 5'。 – adamwy