Before Mathematica

I figured if I couldn’t explain something clearly in documentation, nobody was ever going to understand it, and it probably wasn’t designed right. And once something was in the documentation, we knew both what to implement, and why we were doing it.

I think this a great practice to follow. I often find it very helpful to write documentation before writing code. I find I end up with a better designed system this way, and as an added bonus it has great documentation too.

— There Was a Time before Mathematica

— Stephen Wolfram

.

The main idea is to regard a program as a communication to human beings rather than as a set of instructions to a computer.

— Donald Knuth

.

Programs are meant to be read by humans and only incidentally for computers to execute.

— Structure and Interpretation of Computer Programs

.

.

2022.08.16 Tuesday ACHK

程式員頭腦 15

數學教育 7

這段改編自 2010 年 4 月 24 日的對話。

.

But while you don’t literally need math for most kinds of hacking, in the sense of knowing 1001 tricks for differentiating formulas, math is very much worth studying for its own sake. It’s a valuable source of metaphors for almost any kind of work.[3] I wish I’d studied more math in college for that reason.

[3] Eric Raymond says the best metaphors for hackers are in set theory, combinatorics, and graph theory.

— Undergraduation

— March 2005

— Paul Graham

.

(安:另外,他提的另一個,有關學習數學的要點是,即使假設你在大學中,學到的數學,在日常生活中沒有用,單單是為獲取,那些嶄新的元素概念本身,就已經能夠令你有超能力;令你有一些,常人沒有的思考工具、比喻語言。)

.

那和我之前,叫你學 programming(電腦編程),意思是一樣的。

那本 programming 教科書《SICP》(Structure and Interpretation of Computer Programs),竟然教曉我,時間的定義和數字的定義等。

— Me@2022-02-13 10:46:08 AM

.

.

2022.02.13 Sunday (c) All rights reserved by ACHK

長頸豹 3

尋找時間的定義 1.2

SICM, 3.2 | SICP, 2.2

這段改編自 2010 年 4 月 10 日的對話。

涉獵多門知識,即使對於「本行」的發展,也會有意想不到的幫助。

例如,我對「什麼是時間」這個物理問題,有極之大的興趣。我想像,如果我只閱讀和研究物理,可能窮一身的時間,也沒有寸進。

估不到,在大概 2006 年,我從一本電腦界的神作中,得到了靈感,開始對「時間定義」有一點理解。然後在今年(2010),再加上我在大學時代時,長期訓練得來的「語理分析」功力,我破解了,「時間」的大部分意思。

(安:你上星期也有提及過,那本電腦界的神作。)

又例如,如果一個人過身後,仍然以某種形式存在的話,究竟確實是以哪一種,或者怎麼樣的形式來存在呢?

從物理和電腦知識中,我得到了一些關鍵靈感。

「靈感」中的「靈」,其實就是解「靈活」、「靈通」,即是有大量和多類型的資料或消息來源。

— Me@2014.06.03

2014.06.03 Tuesday (c) All rights reserved by ACHK

SICP, 3

Just as every day thoughts are expressed in natural language, and formal deductions are expressed in mathematical language, methodological thoughts are expressed in programming languages. A programming language is a method for communicating methods, not just a means for getting a computer to perform operations – programs are written for people to read as much as they are written for machines to execute.

— Lisp: A language for stratified design

— Harold Abelson, Gerald Jay Sussman

— SICP distilled

— jao 

2013.05.31 Friday ACHK

Hacker 3

.

The Jargon File has had a special role in acculturating hackers since its origins in the early 1970s. Many textbooks and some literary works shaped the academic hacker subculture; among the most influential are:

* Hackers: Heroes of the Computer Revolution, by Steven Levy
* Godel, Escher, Bach, by Douglas Hofstadter
* The Art of Computer Programming (TAOCP), by Donald Knuth
* The Mythical Man-Month, by Brooks
* Compilers: Principles, Techniques, and Tools (“the Dragon Book”), by Aho, Sethi, and Ullman
* Structure and Interpretation of Computer Programs (SICP), by Abelson and Sussman
* The C Programming Language (K&R), by Kernighan and Ritchie
* The Hitchhiker’s Guide to the Galaxy, by Douglas Adams
* The Tao of Programming, by Geoffrey James
* The Illuminatus! Trilogy, by Robert Shea and Robert Anton Wilson
* Principia Discordia, by Greg Hill and Kerry Thornley
* The Soul of a New Machine, by Tracy Kidder
* The Cuckoo’s Egg, by Cliff Stoll
* The Unix System, by Stephen R. Bourne
* Hackers & Painters, by Paul Graham
* The Cathedral and the Bazaar, by Eric S. Raymond
* The essays of Richard M. Stallman (many published in Free Software, Free Society: Select Essays of Richard M. Stallman)

– Wikipedia on Hacker (programmer subculture)

.

.

[10] “Hacker” here means a highly skilled programmer, not a computer criminal. — Me

The basic difference is this: hackers build things, crackers break them. — Eric S. Raymond

In academia, a “hacker” is a person who follows a spirit of playful cleverness and enjoys programming.

– Wikipedia on Hacker (academia)

.

.

.

2010.03.04 Thursday ACHK

SICM, 3.2

這段改編自 2010 年 4 月 3 日的對話。

《SICM》(Structure and Interpretation of Classical Mechanics)中的編程語言,除了 Scheme 的本體外,還會用到作者特製的力學程式庫 Scmutils。而這個程式庫(library)卻只有 Linux 的版本,不能安裝在 Windows 之中。那導致我要特意在我的 Windows 中,先裝一個 virtual machine(虛擬機器),從而在那個虛擬機器之上,再安裝一個 Linux 作業系統。

閱讀《SICM》,除了間接令我,發現「時間」的定義外,還令我第一次接觸「virtual machine」這個概念。兩者各自都是,我個人智力發展的一個里程碑。

— Me@2012.12.25

2012.12.25 Tuesday (c) All rights reserved by ACHK

尋找時間的定義

SICM, 3 | SICP, 2

這段改編自 2010 年 4 月 3 日的對話。

當年,我初看《SICM》(Structure and Interpretation of Classical Mechanics)時,我不太懂做那些練習題目,因為那時,我是只是初學,而尚未能掌握,內裡的編程語言 Scheme programming language。

為了熟習 Scheme,我先行閱讀了《SICM》的姊妹作,《SICP》(Structure and Interpretation of Computer Programs)的頭幾課。

《SICP》跟《SICM》,同樣是超級名著。但是它不易理解。幸好,它官方網站提供了,一些 1986 年的講課錄影。當年(2006),尚未流行使用 YouTube,所以我要花很多時間,下載那些錄影。我還記得,每節課的錄影檔案,有 600MB 那麼大。

雖然那麼費神,但卻換來意外的收穫。《SICP》令我瞭解「時間」的定義。

This image is taken from 《SICP》 and 《SICP》 itself is licensed under a Creative Commons Attribution-Noncommercial 3.0 Unported License.

最令我意想不到的是,那竟然是來自一本電腦書,而不是物理書。

— Me@2012.12.23

2012.12.23 Sunday (c) All rights reserved by ACHK

SICM, 2

這段改編自 2010 年 4 月 3 日的對話。

《SICM》(Structure and Interpretation of Classical Mechanics)總共花了我兩年的時間。我大概由 2006 年,閱讀至 2008 年。除了閱讀課文外,我還把內裡的幾乎所有練習,無論是數學題,還是程式題,都一一擊破。要花那麼長的時間才能完成,主要是因為上班的工務繁忙。每日可以花在自修的時間,通常也不會超過半小時。

雖然時間成本奇高,但是,我仍然覺得是值得的。一來,它是一本名著,質素非常高。二來,它竟然把我人生的兩大興趣,重疊在一起。

— Me@2012.12.21

2012.12.21 Friday (c) All rights reserved by ACHK

程式員頭腦 14.3

SICM, 1.3

這段改編自 2010 年 4 月 3 日的對話。

即使有時會剛巧得到正確的結果,但是由於胡亂推導,大家也不知道,那個正確結果的真正由來。所以,每一代的學生,都不可能明白那一個部分。

要戒除「暗地裡轉換意思」的陋習,並不困難。如果透過編寫程式,來解決力學問題,你就要先把那個力學問題,翻譯制訂成電腦程式的版本。那樣,在過程中,你自然會百分百釐清了,所有符號的意義,因為,在同一個程式中,同一個符號,電腦只會容許,有唯一的一個意思。電腦不會讓你(,在沒有事先特別聲明的情況下),任意放大、縮小 或 更改,那一個符號的意思。電腦不會錯失,你任何的「概念扭曲」或者「概念滑轉」,所以不會有絲毫的容忍。

由於要你「寫程式學力學」,《SICM》(Structure and Interpretation of Classical Mechanics)會教你一種編程語言 Scheme programming language。這種語言的好處是,你學了一句後,就可以立刻應用那一句,而不像一般的程式語言,應用前,要先行學習一大堆語法。

(安:那本書真的用 programming(電腦編程),來講解 mechanics(力學)?)

無錯。正如一般的教科書,課文以外,《SICM》還有例題和練習題。而例子和練習之中,有超過一半是程式題目。其餘的則是文字題目和數學題目。

但是,《SICM》的正題始終是力學,而不是寫程式。正如,力學需要用數學。但是數學在這本書內,只是工具,不是主菜。

— Me@2012.12.18

2012.12.19 Wednesday (c) All rights reserved by ACHK

概念滑轉

SICM, 1.2 | 程式員頭腦 14

這段改編自 2010 年 4 月 3 日的對話。

“In almost all textbooks, even the best, this principle is presented so that it is impossible to understand.” (K. Jacobi, Lectures on Dynamics, 1842-1843). I have not chosen to break with tradition.

— V. I. Arnold, Mathematical Methods of Classical Mechanics, footnote, p. 246

Structure and Interpretation of Classical Mechanics

這本書的主要好處是,它會要求你,透過編寫簡短的電腦程式,來解決力學問題。反過來說,你亦可以透過解決力學問題,來練習 programming(電腦編程)。

這本書的主旨是,在經典力學,人們做公式推導的過程中,有時會把一些數字符號的意思,不自覺地改了一點,導致推導失效。例如,運算步驟的第二行和第五行,都會出現的函數 f 這個符號。但是,第二行的 f ,是代表 f(x,y)。而第五行的 f ,卻是指 f(x(t),y(t))。

即使有時會剛巧得到正確的結果,但是由於胡亂推導,大家也不知道,那個正確結果的真正由來。所以,每一代的學生,都不可能明白那一個部分。

如果透過編寫程式,來解決力學問題,你就可以避免了「暗地裡轉換意思」的陋習,因為在同一個程式中,同一個符號,電腦只會容許,有唯一的一個意思。電腦不會錯失,你任何的「概念扭曲」或者「概念滑轉」,所以不會有絲毫的容忍。

— Me@2012.12.17

2012.12.17 Monday (c) All rights reserved by ACHK

SICM

這段改編自 2010 年 4 月 3 日的對話。

(安:我怎樣把 mechanics(力學)學得好一點?)

哪一門力學?經典力學,還是量子力學?

(安:經典力學。)

你想應用在哪些地方?

(安:暫時純粹為了求知和娛樂。)

那我介紹一本名著給你。它叫做《SICM》(Structure and Interpretation of Classical Mechanics)。它免費發布於 MIT(麻省理工學院)的網站。

這本書的主要好處是,它會要求你,透過編寫簡短的電腦程式,來解決力學問題。反過來說,你亦可以透過解決力學問題,來練習 programming(電腦編程)。

— Me@2012.12.15

2012.12.15 Saturday (c) All rights reserved by ACHK

Hacker 3

.

The Jargon File has had a special role in acculturating hackers since its origins in the early 1970s. Many textbooks and some literary works shaped the academic hacker subculture; among the most influential are:

* Hackers: Heroes of the Computer Revolution, by Steven Levy
* Godel, Escher, Bach, by Douglas Hofstadter
* The Art of Computer Programming (TAOCP), by Donald Knuth
* The Mythical Man-Month, by Brooks
* Compilers: Principles, Techniques, and Tools (“the Dragon Book”), by Aho, Sethi, and Ullman
* Structure and Interpretation of Computer Programs (SICP), by Abelson and Sussman
* The C Programming Language (K&R), by Kernighan and Ritchie
* The Hitchhiker’s Guide to the Galaxy, by Douglas Adams
* The Tao of Programming, by Geoffrey James
* The Illuminatus! Trilogy, by Robert Shea and Robert Anton Wilson
* Principia Discordia, by Greg Hill and Kerry Thornley
* The Soul of a New Machine, by Tracy Kidder
* The Cuckoo’s Egg, by Cliff Stoll
* The Unix System, by Stephen R. Bourne
* Hackers & Painters, by Paul Graham
* The Cathedral and the Bazaar, by Eric S. Raymond
* The essays of Richard M. Stallman (many published in Free Software, Free Society: Select Essays of Richard M. Stallman)

— Wikipedia on Hacker (programmer subculture)

.

.

[10] “Hacker” here means a highly skilled programmer, not a computer criminal. — Me

The basic difference is this: hackers build things, crackers break them. — Eric S. Raymond

In academia, a “hacker” is a person who follows a spirit of playful cleverness and enjoys programming.

— Wikipedia on Hacker (academia)

.

.

.

2010.03.04 Thursday ACHK