程式時間 2

多次元宇宙 10

程式員頭腦 8

時間定義 3

用 functional programming languages(函數程式語言)所寫的程式,程式內是沒有 state(狀態)的。

「程式內是沒有 state」的意思是,程式內只有「常數」,沒有「變數」。

程式內的 data(數據)是不會隨時間改變的。

在那類程式中,是沒有「時間」。

例如,有一個「加法程式」,要你輸入 a 和 b,然後它會運算 c = a + b,告訴你答案 c 是什麼。

那個程式內部,本身是沒有儲存任何 variable values(變數數值)。

例如,你輸入 3 和 7,程式就會輸出 10。

同一組 input(輸入),就會有同一個 output(輸出)。

無論你在任何時間,運用那個「加法程式」,只要你輸入 3 和 7,它就會輸出 10。

所以說,那個「加法程式」沒有「時間」。

不是任何程式也是沒有「時間」的。

例如,一個「銀行會計程式」有一個變數 x,用來代表我的戶口結餘。

因為我的戶口結餘會隨時間改變,所以在不同日子輸入指令「請問我的戶口結餘是多少?」,程式會輸出不同的答案。

雖然是同一個指令「請問我的戶口結餘是多少?」,但是在不同的時間,那個「銀行會計程式」會輸出不同的答案。

所以說,那個「銀行會計程式」有「時間」。

「有『時間』」是意思是,有 variable(變數)的數值改變。

同一個 variable x,不同的「時間」,有不同的數值。

即是話,不同的數值對應於不同的「時間」。

例如,對於那個「銀行會計程式」來說,同一個戶口,結餘的不同數值,就為之不同的「時間」。

— Me@2010.04.11

2010.04.12 Monday (c) All rights reserved by ACHK

Functional programming 4

Most programming languages describe computation in an imperative style, i.e., as a sequence of commands, although some languages, such as those that support functional programming or logic programming, use alternative forms of description.

— Wikipedia on Programming language

2010.04.11 Sunday ACHK

SUSE Studio

SUSE Studio is an online open-source Linux creation tool by Novell, Inc.. Users can develop their own Linux OS, mainly choosing which applications they want on their “custom” Linux and how it looks. In addition, they can choose between Home and Enterprise bases, GNOME and KDE desktops, and a plethora of other features. You can create a fully functional system with Firefox, 3D graphics, and whatever apps you can find installed.

— Wikipedia on SUSE Studio

2010.04.10 Saturday ACHK

Functional programming 3

Widespread declarative domain specific languages like SQL and Lex/Yacc, use some elements of functional programming, especially in eschewing mutable values. Spreadsheets can also be viewed as functional programming languages.

— Wikipedia on Functional programming

2010.04.09 Friday ACHK

Lambda calculus

Functional programming has its roots in the lambda calculus, a formal system developed in the 1930s to investigate function definition, function application, and recursion. Many functional programming languages can be viewed as elaborations on the lambda calculus.

— Wikipedia on Functional programming

2010.04.08 Thursday ACHK

Functional programming

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state.

— Wikipedia on Functional programming

2010.04.07 Wednesday ACHK

程式時間

多次元宇宙 9

程式員頭腦 7

時間定義 2

你要有寫程式的訓練,因為寫程式的訓練會令你多了很多「思考工具」。例如,我也估不到我在程式書中,閱讀到「時間」的定義。書中所描述的,只是在一個程式內「時間」的定義。但是,把「程式時間」引申開去,令我瞭解了「物理時間」的意思。

有一類 programming languages(程式語言),叫做「functional programming languages(函數程式語言)」。用 functional programming languages 所寫的程式,程式內是沒有「時間」的。

怎樣為之「程式內是沒有『時間』」呢?我們可以先倒轉來想:怎樣為之「程式內是有『時間』」呢?

如果一個程式是有 state(狀態)的,那就為之有「時間」。「有 state」的意思是,同一個 variable(變數),它的數值可以有變化。

例如,一個銀行會計程式有一個變數 x。 x 用來代表我的戶口結餘。所以,x 的數值會有變化。因為那個銀行會計程式儲存了 x,而 x 可以有變化,所以我們說,那個銀行會計程式有「時間」。

不同的 x 數值,就對應於那個程式的不同 state。例如:

程式 state 1, x = HK$ 100

程式 state 2, x = HK$ 200

程式 state 3, x = HK$ 170

程式 state 4, x = HK$ 251

程式 state 5, x = HK$ 350

— Me@2010.04.06

2010.04.06 Tuesday (c) All rights reserved by ACHK

Ninety-ninety rule

The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

90% of the project accounts for the first 90% of the budget. The remaining 10% of the project accounts for the other 90% of the budget.

— Wikipedia on Ninety-ninety rule

2010.04.06 Tuesday ACHK

Designed for smart programmers

As for Arc, I think you actually get a
better language if you design for smart
programmers. Designed for smart
programmers: C, Smalltalk, Lisp. Designed
for “average” programmers: Cobol, Pascal,
Java. See a pattern here?

Paul Graham
Tuesday, December 18, 2001

2010.04.05 Monday ACHK

The primordial forces

* Programming in Lisp is like playing with the primordial forces of the universe. It feels like lightning between your fingertips. No other language even feels close.

o Glenn Ehrlich

2010.04.04 Sunday ACHK

Code refactoring

Code refactoring is the process of changing a computer program’s source code without modifying its external functional behavior in order to improve some of the nonfunctional attributes of the software. Advantages include improved code readability and reduced complexity to improve the maintainability of the source code, as well as a more expressive internal architecture or object model to improve extensibility.

— Wikipedia on Code refactoring

2010.04.02 Friday ACHK

Peter Norvig

On practical applications of academic concepts, he mentions that part of the problem is that academics do not see the whole problem and another part is education. If you have a bunch of programmers who don’t understand what a monad is and haven’t taken courses in category theory, there’s a gap.

— Wikipedia on Coders at work

2010.04.01 Thursday ACHK

Lisp macros

Lisp’s uniform, parenthesized syntax works especially well with macros. Languages of the Lisp family, such as Common Lisp and Scheme, have powerful macro systems because the syntax is simple enough to be parsed easily. Lisp macros transform the program structure itself, with the full language available to express such transformations. Common Lisp and Scheme differ in their macro systems: Scheme’s is based on pattern matching, while Common Lisp macros are functions that explicitly construct sections of the program.

Being able to choose the order of evaluation (see lazy evaluation and non-strict functions) enables the creation of new syntactic constructs (e.g. control structures) indistinguishable from those built into the language. For instance, in a Lisp dialect that has cond but lacks if, it is possible to define the latter in terms of the former using macros.

Macros also make it possible to define data languages that are immediately compiled into code, which means that constructs such as state machines can be implemented in a way that is both natural and efficient.

— Wikipedia on Macro (computer science)

2010.03.30 Tuesday ACHK

Clebsch-Gordan coefficients software

This program is written by me to calculate the Clebsch-Gordan coefficients.

To use it, copy-and-paste the text of this file onto DrScheme and run it.

Within DrScheme, you have to select the Language “Pretty Big”.

You can contact me if you find any bugs in this program.

2010.03.28 Sunday (c) All rights reserved by ACHK

Copyleft 4

The Open Invention Network (OIN) is a company that acquires patents and licenses them royalty free to entities which, in turn, agree not to assert their own patents against Linux or Linux-related applications.

— Wikipedia on Open Invention Network

2010.03.27 Saturday ACHK

The Maxwell’s equations of programming

Interactive means that programming is a dialog with Lisp. You enter an expression and Lisp computes the side effects (for example output) and the value.

So your programming session is like ‘talking’ with the Lisp system. You work with it until you get the right answers.

Alan Kay (of Smalltalk fame) calls the original definition of Lisp evaluation in Lisp the Maxwell’s equations of programming.

— Rainer Joswig

2010.03.26 Friday ACHK

Linux adoption

In January 2001 Microsoft CEO Bill Gates explained the attraction of adopting Linux, in an internal memo that was released in the Comes vs Microsoft case. He said:

“ Our most potent Operating System competitor is Linux and the phenomena around Open Source and free software. The same phenomena fuels competitors to all of our products. The ease of picking up Linux to learn it or to modify some piece of it is very attractive. The academic community, start up companies, foreign governments and many other constituencies are putting their best work into Linux. ”

— Wikipedia on Linux adoption

2010.03.23 Tuesday ACHK

Upgrade path

Somewhere in the course of doing Viaweb, someone gave me a very useful piece of advice: users always want an upgrade path, even though as a rule they’ll never take it. Rtml was our upgrade path. If you wanted to, you could get absolute control over everything on your pages.

— Lisp in Web-Based Applications, Paul Graham

2010.03.21 Sunday ACHK