- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是识字编程概念的新手。我正在阅读 Donald Knuth's paper (PDF)关于这个主题,在一开始,在引言中,他说:
Instead of imagining that our main task is to instruct a computer what todo, let us concentrate rather on explaining to human beings what we wanta computer to do.
He or she [the practitioner of literate programming] strives for a programthat is comprehensible because its concepts have been introduced in anorder that is best for human understanding, using a mixture of formaland informal methods that reinforce each other.
A thing about a program is its structural relationships.A complex piece of software consists of simple parts andsimple relations between those parts; the programmer’stask is to state those parts and those relationships,in whatever order is best for human comprehension—not in some rigidly determined order like top-down orbottom-up.
(...)
Top-down programming gives you a strong idea ofwhere you are going, but it forces you to keep a lot of plans in yourhead; suspense builds up because nothing is really nailed down untilthe end. programming has the advantage that you continually wield amore and more powerful pencil, as more and more subroutines have beenconstructed; but it forces you to postpone the overall programorganization until the last minute, so you might flounder aimlessly.
Thus the WEB language allows a person to expressprograms in a “stream of consciousness” order. TANGLEis able to scramble everything up into the arrangementthat a PASCAL compiler demands†.This feature of WEB is perhaps its greatest asset;
最佳答案
在大多数情况下,Haskell 在订购方面非常灵活。在 Haskell 模块中,所有的声明和定义可以以任何顺序出现。由于引用透明性,提取子问题以便在其他地方实现它们也很容易。
顺序很重要的主要领域是模式匹配。函数的所有方程必须在一起,并且由于它们按顺序匹配,因此它们不能总是重新排序。但是,我不认为这是一个重大限制,因为 (a) 这通常是非常局部的,并且 (b) 具有大量方程的大函数可以(并且可能应该)重构为更小的部分,然后更容易重新排序.
也许最烦人的约束是导入声明必须在模块的顶部。这确实稍微打破了意识流,许多用 Haskell 编写的识字程序都以“不要介意这些导入,稍后你会看到我们需要它们的地方”之类的声明开始。如果能够在文本中更自然的点命名导入,从上下文中可以清楚地知道为什么需要它们,这将更符合 Knuth 对文学编程的定义。
除此之外,我认为 Haskell 非常适合文学编程。它可能不完全符合 Knuth 的定义,但我认为它已经足够接近了。
关于haskell - Haskell 中的文学编程真的是 "literate programming"吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16869050/
我在以下 URL http://netaimg.co.il/%D7%A6%D7%95%D7%A8-%D7%A7%D7%A9%D7%A8/ 中收到了一份表单(希伯来语) 每当有人在使用 Google C
是否有一个(文学)算法可将in度> 1的所有节点拆分为每个传入边缘一个节点,以便每个拆分节点仅具有一个传入边缘和所有原始出局边缘? 例: 假设我们有以下有向图:A B C(从A到B,B到A,B到C
我是一名优秀的程序员,十分优秀!