在本页中:
atom?
annotation?
end-annotation
write-file

1.11 操作简单的HTML文档: "docs.rkt"

 (require htdp/docs) package: htdp-lib

本教学包提供三个函数,用于创建简单的“HTML”文档:

Annotation Annotation是以“<”开头并以“>”结尾的符号。 结束annotation是以“</”开头的annotation。

函数

(atom? x)  boolean?

  x : any/c
判断某个值是否是数字、符号或字符串。

函数

(annotation? x)  boolean?

  x : any/c
确定符号是否是文档annotation。

函数

(end-annotation x)  Annotation

  x : Annotation
读入annotation,生成对应的结束annotation。

函数

(write-file l)  true

  l : (list-of atom)
读入符号和annotation的表,将其打印为“文件”。

示例会话:将教学包设为"docs.rkt"并单击“运行”:
> (annotation? 0)
false
> (annotation? '<bold>)
true
> (end-annotation 0)
end-annotation: not an annotation: 0
> (write-file (list 'a 'b))
a b