1 2 3 4 5 6 7 8 9 10 11  (defun small-prime-number-p (n) "Return T if N, an integer, is a prime number. Otherwise, return NIL." (cond ((or (< n 2)) nil) ((= n 2) t) ((divisorp 2 n) nil) (t (loop for i from 3 upto (sqrt n) by 2 never (divisorp i n))))) 

Golang 虽然 在注释方面做的普通，但是在官方 library 以及最佳实践方面成功地鼓励了人们尽可能地写非常详细的注释，具体到一个 struct 的各个字段上。尤其是在 kubernetes 社区里面, 其Space Shuttle style 的 Code 对于社区的蓬勃发展可以说是一个极大的背后功臣，从如下的代码便可一窥其风格：

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  // Adapts a ConfigMap into a projected volume. // // The contents of the target ConfigMap's Data field will be presented in a // projected volume as files using the keys in the Data field as the file names, // unless the items element is populated with specific mappings of keys to paths. // Note that this is identical to a configmap volume source without the default // mode. type ConfigMapProjection struct { LocalObjectReference // If unspecified, each key-value pair in the Data field of the referenced // ConfigMap will be projected into the volume as a file whose name is the // key and content is the value. If specified, the listed keys will be // projected into the specified paths, and unlisted keys will not be // present. If a key is specified which is not present in the ConfigMap, // the volume setup will error unless it is marked optional. Paths must be // relative and may not contain the '..' path or start with '..'. // +optional Items []KeyToPath // Specify whether the ConfigMap or it's keys must be defined // +optional Optional *bool } 

Knuth 曾经发明过一种将注释发挥到极致的语言风格: Literate Programming。结构很类似于 Tex 和 Markdown, 代码穿插于文档之中，工具可以分别提取出其中的文档与源代码。

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  \section{Hello world} Today I awoke and decided to write some code, so I started to write Hello World in \textsf C. <>= /* <> */ #include int main(int argc, char *argv[]) { printf("Hello World!\n"); return 0; } @ \noindent \ldots then I did the same in PHP. <>= > */ echo "Hello world!\n"; ?> @ \section{License} Later the same day some lawyer reminded me about licenses. So, here it is: <>= This work is placed in the public domain.