The “$” Operator

Next to the “.” operator there is another function-oriented operator that you’ll see often in Haskell code. This is the function application operator and it’s defined like this:

f $ x = f x

Weird right? Why does Haskell have this?

In Haskell, normal function application has a higher precedence than any other operator and it’s left-associative:

f g h j x == (((f g) h) j) x

Conversely, “$” has the lowest precedence of all operators and it’s right-associative:

f $ g $ h $ j $ x == f (g (h (j x)))

Using “$” can make Haskell code more readable as an alternative to using parentheses. It has other uses too, more on that later.

— Using the Dropbox API from Haskell

— by Rian on January 02, 2012

2012.05.31 Thursday ACHK

Machinarium

Machinarium is a puzzle point-and-click adventure game developed by Amanita Design.

Development

Machinarium was developed over a period of three years, by seven Czech developers, who financed the project with their own savings. The marketing budget for the game was a scant $1,000.

The game was in development for the Xbox 360 platform for a period of six months; however, Microsoft, whom the developers had approached to publish the title on Xbox Live Arcade, ultimately decided not to do so. Microsoft does not allow games to be released on Xbox Live Arcade without a publisher attached to the title, and the developers were reluctant to approach a third party to publish the game, as this would mean that profits for the developers from sales over Xbox Live Arcade would be greatly reduced.

Subsequently, Amanita Design approached Sony, whose policies do allow for self-publishing on the PlayStation Network platform, and have submitted the game to them for approval, in order to release the game on the PlayStation Network.

— Wikipedia on Machinarium

2012.05.31 Thursday ACHK

閱讀理解 1.1

這段改編自 2010 年 6 月 2 日的對話。

(CYW:做中文科的閱讀理解題目時,我好像答來答去,都答不中要點。)

你比較一下,你的答案和老師的答案相差什麼。看看老師的答案,有沒有道理。知不知道什麼為之「有道理」?

(CYW:事後我會閱讀老師的標準答案。但我通常也不明白,那些答案在說什麼。那些答案的思想,有時是由文章之中,十分間接地歸納出來。坦白說,我覺得有些答案是「穿鑿附會」,只有題目的作者才會答得到。)

如果一份閱讀理解的答案,除了你覺得沒有道理外,你所有同學也覺得沒有道理,而你的老師又解釋不到,那些答案道理何在的話,那些答案就真的是,客觀地「沒有道理」。換句話說,錯不在你,只是那份閱讀理解本身沒有價值。既然是那樣,你就毋須去理會考究它。

— Me@2012.05.31

2012.05.31 Thursday (c) All rights reserved by ACHK