1.9 Manipulating Simple HTML Documents: "docs.ss"

► |  | Teachpacks

1 | Ht DP Teachpacks
2 | Ht DP/ 2e Teachpacks

▼ | 1 | Ht DP Teachpacks

1.1 | Manipulating Images: "image.ss"
1.2 | Simulations and Animations: "world.ss"
1.3 | Converting Temperatures: "convert.ss"
1.4 | Guessing Numbers: "guess.ss"
1.5 | Master Minding: "master.ss"
1.6 | Simple Drawing: "draw.ss"
1.7 | Hangman: "hangman.ss"
1.8 | Managing Control Arrows: "arrow.ss"
1.9 | Manipulating Simple HTML Documents: "docs.ss"
1.10 | Working with Files and Directories: "dir.ss"
1.11 | Graphing Functions: "graphing.ss"
1.12 | Simple Graphical User Interfaces: "gui.ss"
1.13 | An Arrow GUI: "arrow-gui.ss"
1.14 | Controlling an Elevator: "elevator.ss"
1.15 | Queens: "show-queen.ss"
1.16 | Matrix Operations: "matrix.ss"

On this page:

atom?
annotation?
end-annotation
write-file

top← prev up next →

#### 1.9`` Manipulating Simple HTML Documents: "docs.ss"

The teachpack provides three operations for creating simple “HTML” documents:

Annotation An Annotation is a symbol that starts with “<” and ends in “>”. An end annotation is one that starts with “</”.

( atom? x) → boolean?
x : any/c

Determines whether or not a Scheme value is a number, a symbol, or a string.

( annotation? x) → boolean?
x : any/c

Determines whether or not a Scheme symbol is a document annotation.

( end-annotation x) → Annotation
x : Annotation

Consumes an annotation and produces a matching ending annotation.

( write-file l) → true
l : (list-of atom)

Consumes a list of symbols and annotations and prints them out as a "file".

Sample session: set teachpack to “docs.ss”> and click RUN:

> ( annotation? 0)
false
> ( annotation? '<bold>)
true
> ( end-annotation 0)
end-annotation: not an annotation: 0
> ( write-file ( list 'a 'b))
a b

top← prev up next →