iT邦幫忙

2021 iThome 鐵人賽

DAY 27
0
Modern Web

寫出好維護又簡潔的 react 程式碼 feat: Function Programming系列 第 27

day27: function composition

今天補充一下,function composition 的概念。

在之前我們有提過 pipe 和 compose 的用法,
但是他的基本概念就是 composition 組合的概念。

什麼是組合的概念,我們先來看以下的定義:

Function composition is a way of combining pure functions to build more complicated ones. Like the usual composition of functions in mathematics, the result of one function is passed as the argument of the next, and the result of last one is the result of the whole.

簡單的解釋上面的定義,就是一種純函數組合的概念,一個函式的結果會成為另一個函式的輸入,
也就是一套組合拳的概念,經由不同的作用,把他組合成一套完整的行為。

https://dev.to/pratiksharm/composition-of-functions-178g


上一篇
day26: 開始體驗 ramda.js
下一篇
day28: Pointfree
系列文
寫出好維護又簡潔的 react 程式碼 feat: Function Programming30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言