编程语言与软件工程2014eecg.toronto.edu编辑精选
记法作为思维的工具
Notation as a Tool of Thought (1979)
入门 · 约 50 分钟读完前置知识:编程基础、数学记号常识、APL 初步了解
导读
这是 Kenneth Iverson 1979 年的经典论文《Notation as a Tool of Thought》,讨论记法(notation)如何不仅是表达工具,也能成为思考和计算的工具。文章主张编程语言可以兼具可执行性与数学记法那种简洁、通用的特性,APL 正是这种思想的代表。
HN 关注点:记法如何塑造编程与数学思维,以及 APL/J/K 传统对现代编程语言设计和代码风格的影响。
后来怎么样
这篇论文成为 APL/J/K 等数组语言与“记法即思维工具”论述的经典来源,长期影响编程语言设计、代码可读性与记法研究。
HN 评论精选
这几条评论里:补充 3 亲历 1
亲历作者深受论文影响,并尝试把 APL 式记法的感觉引入 Python 风格指南。
这是我最喜欢的论文之一,对我编码的影响比我读过的任何东西都大。如果没有为这些想法设计的语言,很难真正利用它们,但我尝试为 Python 写了一份风格指南,至少接近那种感觉:https://github.com/fastai/fastai/blob/master/docs/style.md (注:这种 Python 编码方式不适合大多数人;我写它是因为很多人要求我记录自己的方法,而不是希望别人照做。但如果你好奇与 PEP8 很不同的代码布局,可以看看。)
jph00查看英文原文
This is one of my favorite papers and a bigger influence on my coding than anything else I've read. It's hard to really take advantage of these ideas without a language designed for that, but I have made an attempt to document a style guide for python that tries to get some of the feel at least: https://github.com/fastai/fastai/blob/master/docs/style.md (NB: this approach to coding in Python won't suit most people, for many reasons - I wrote it because I had a lot of requests to document my approach, not because I want anyone else to do the same thing. But if you're curious about ways to lay out code that are rather different to PEP8, do check it out!)
补充记法选择本身就是分析,会显著影响理解的难易。
Nicholas Cooke 在《Handbook of Musical Analysis》中说“所有记法都是分析”,这句话一直深深影响我。虽然他谈的是音乐记谱,但这在其他领域似乎也成立。选择如何记谱是很重要的分析决策,某些记法形式会帮助或妨碍分析。比如费曼图帮助理解粒子相互作用背后的数学;而罗马数字让各种算术比阿拉伯数字难得多。
seanhunter查看英文原文
Nicholas Cooke in "Handbook of Musical Analysis" says something that has always influenced me very deeply: > All notation is analysis Obviously he's talking in the specific context of musical notation, but it seems true in other fields too. Choosing how to notate seems a very important analytical decision and certain forms of notation help or hinder analysis. Feynman diagrams for example famously help to understand the maths underlying particle interactions. Roman numerals (for a different example) make all kinds of arithmetic much harder than in Arabic notation.
补充探索可计算的数学图示/非文本编程语言,但图示的语境依赖是挑战。
论文第 378 页说,编程语言的可执行性和通用性,可以与数学记法那些使其成为有效思维工具的性质结合在单一语言中。我最近在读《Seven Sketches in Composability》,思考数学多么依赖介于绘图和书写之间的图示。在研究会议上,我常看到人们用图表和数学记号推理。顺着这篇文章,我想是否也能把数学图示形式化到可计算——一种非严格文本的编程语言。iPython notebook 常在符号表达式和代码实现之间切换。可能缺少的是上下文:图示比文本更具索引性,常指向先前定义的问题语境,这似乎是个有潜力的设计问题。
cproctor查看英文原文
"The preceding sections have attempted to develop the thesis that the properties of executability and universality associated with programming languages can be combined, in a single language, with the well-known properties of mathematical notation which make it such an effective tool of thought" (378). I've been working through "Seven Sketches in Composability" [1], posted here a few weeks ago, and thinking about how much math relies in diagrams which are somewhere between drawing and writing. In research meetings, I often see people reasoning with diagrams and mathematical notation. In the vein of this article, I wonder whether it would also be possible to formalize mathematical pictographs to the point where they could be computable--a not-strictly-textual programming language. iPython notebooks often toggle between symbolic expressions and their implementation in code. One thing that might be missing is context. Diagrams are indexical (pointing to contextual meaning) even more than text, often illustrating a problem that has previously been defined. This feels to me like potentially-fruitful design problem. [1] https://news.ycombinator.com/item?id=16677395
补充推荐 Iverson 用 J 描述单纯形算法的论文,认为 APL/J/K 记法简洁可执行但学习曲线陡。
另见 http://www.jsoftware.com/papers/DFSP.htm ——这是这种记法令人印象深刻的实际应用。我没见过比这里给出的单纯形算法例子更简洁(但仍严谨到可执行)的描述。我希望更多人熟悉 Iverson 的工作(APL、J)及其后代(主要是 K)。相比之下,其他东西都显得不必要地复杂。学习曲线确实陡峭,但很值得。
beagle3查看英文原文
See also: http://www.jsoftware.com/papers/DFSP.htm - impressive practical application of this notation. I've never seen a more succinct (yet still rigorous to the point of being executable) description of the Simplex algorithm, which is given as an example here. I wish more people were familiar with Iverson's work (APL, J) and its descendents (mostly K). Everything else is so needlessly complex in comparison. There is a steep learning curve, true - but it is well worth it.
相关资源
从这篇论文所有 HN 讨论帖的全部评论里整理出来的链接。
历次讨论
- 2014Hacker News 讨论帖58 分 · 12 评
- 2018Hacker News 讨论帖150 分 · 13 评
同领域还值得读
Google 的软件工程(2017)
Software Engineering at Google (2017)
介绍了 Google 的软件工程实践,包括其单一代码库(monorepo)、几乎全部开发在主干进行而非分支、代码审查、构建系统 Blaze、协议缓冲区等工具与流程,并讨论了频繁重…
编程语言与软件工程2017 · 1,127 分 · 465 评 · 引用 15入门 · 约 45 分钟编辑精选Peter Naur:编程作为理论构建 (1985)
Peter Naur – Programming as Theory Building (1985)
Peter Naur 1985 年的经典论文《Programming as Theory Building》提出:编程的本质不是写代码或文档,而是在程序员头脑中构建对程序及其运行…
编程语言与软件工程2016 · 629 分 · 74 评入门 · 约 45 分钟编辑精选SciPy 1.0:Python 科学计算的基础算法
SciPy 1.0: fundamental algorithms for scientific computing in Python
这篇发表于 Nature Methods 的论文介绍了 SciPy 1.0——Python 科学计算生态的基石库,涵盖其核心算法模块(优化、积分、插值、线性代数等)、软件架构与社…
编程语言与软件工程2020 · 387 分 · 98 评入门 · 约 45 分钟编辑精选Lisp 的历史(1979)
History of Lisp (1979)
这是 Lisp 发明者 John McCarthy 于 1979 年为 HOPL(编程语言史)会议撰写的回顾文章,讲述 Lisp 的起源、设计动机与早期演进,文中也涉及 if 表…
编程语言与软件工程2018 · 352 分 · 44 评入门 · 约 45 分钟编辑精选使用 NumPy 进行数组编程
Array Programming with NumPy
这篇 Nature 文章介绍 NumPy 的数组编程模型及其在科学计算中的核心作用:以 ndarray 为中心,通过向量化操作让 Python 高效处理多维数组。
编程语言与软件工程2020 · 318 分 · 134 评入门 · 约 40 分钟编辑精选