讀到洪士灝老師一篇談科學研究、邏輯訓練、學術強者卻真井底之蛙,滿有趣的紀錄一下
偶然讀到一個講作業系統的投影片,做得滿不錯的
看到偉大的物理學家霍金,其生平故事改編電影,一定要看,太正了
閒談:剛剛估狗看到tumbler blog,讀這篇文章時看到Medium,以及看了許久中於今天知道是什麼的logdown,天啊,這兩個網站的畫面真的太正了,害我都想跳槽了,估狗部落格真是醜死了 XD
這操縱者太強大了!!!! #四足 #怪手 #媲美機械獸 #再度跪在電腦面前
今日目標:先學完higher order function,再回去複習module patern,最後回去讀recursion
偶然讀到一個講作業系統的投影片,做得滿不錯的
看到這個讓我想起以前曾看過Jserv的投影片,也是上傳到slideshare這網站,當初就在想上傳到這網站的slide可以弄動畫嗎,結論:果然可以,下次一定要來玩玩 XD
閒談:剛剛估狗看到tumbler blog,讀這篇文章時看到Medium,以及看了許久中於今天知道是什麼的logdown,天啊,這兩個網站的畫面真的太正了,害我都想跳槽了,估狗部落格真是醜死了 XD
這操縱者太強大了!!!! #四足 #怪手 #媲美機械獸 #再度跪在電腦面前
今日目標:先學完higher order function,再回去複習module patern,最後回去讀recursion
higher order function學習教材
- Nested Higher-Order Functions in JavaScript : Iterating
- Understand JavaScript Callback Functions and Use Them | JavaScript is Sexy
- Higher Order Functions — Functional JavaScript — Medium (讀不懂)
今日從Higher-Order Functions :: Eloquent JavaScript的Abstracting array traversal這節開始,提到我先前卡關許久的forEach(),這篇提到這function的用法
forEach(array, action)
- This looks quite a lot like the classical for loop, with its body written as a block below it. However, now the body is inside the function value, as well as inside the parentheses of the call to forEach. This is why it has to be closed with the closing brace and closing parenthesis.
- Using this pattern, we can specify a variable name for the current element (number), rather than having to pick it out of the array manually.
forEach是JavaScript內定義的function,在此附上它的定義
Array.prototype.forEach = function(callback,thisObject) {};
由於尚未讀過CH4的two array-traversing loops,這篇用forEach改寫的讀不太懂,去找別篇資料繼續學習forEach
讀這篇時才知道Higher-order function又稱之為Callback function
讀這篇時才知道Higher-order function又稱之為Callback function
這篇不錯,提到JavaScript的function是first-class object,所以function可以當作一個parameter傳入另一個function去
- In JavaScript, functions are first-class objects; that is, functions are of the type Object and they can be used in a first-class manner like any other object (String, Array, Number, Object, etc.), since they are in fact objects themselves. They can be “stored in variables, passed as arguments to functions, created within functions, and returned from functions”1.
這篇提到一個term(專業術語),functional programming,Higher-order function被廣泛用於jQuery
喔喔喔,他提到forEach與Callback function時有順便講到Anoymous function的定義
- anonymous function (a function without a name)
原來我們只是傳function的定義當作另一個function的parameter
- When we pass a callback function as an argument to another function, we are only passing the function definition. We are not executing the function in the parameter.
換個口味稍微略讀一下Eloquent JavaScript的Higher-Order Functions 這節,老實說寫得不好,沒抓到精隨,略讀後就打算直接跳過,繼續讀其他篇資料
這篇不錯,雖然標題是Higher-order function但是前面有很長一大串在討論Closure (第I與II節)
這篇文章很正的一點在於他討論了parentheses "()" 在JavaScript裡的用途,對於Higher-order function理論的解釋不多,但是解釋function與Closure非常之清楚,難怪JavaScript is Sexy要說Callback Functions Are Closures。
疲勞了,剩下的明天再作業
沒有留言:
張貼留言