Scheme to xhtml

Problem 1.1

(x-paragraph "Now is the time")
(x-paragraph "for all good men")
(x-paragraph "to come" (x-break) " to the aid")
(x-paragraph "of their country.")

Now is the time

for all good men

to come
to the aid

of their country.

Problem 1.2

(x-paragraph "The function:")
   (x-paragraph "f(x) = x/2 for even x, 3x + 1 for odd x")
   (x-paragraph "has unpredictable behavior when applied recursively.")
   (x-paragraph "For x_0 = 21, the values are:")
   (x-paragraph (map x-word (wind-down 21)))
   (x-paragraph "But for x_0 = 27, the values are:")
   (x-paragraph (map x-word (wind-down 27)))
   (x-paragraph " For all integers between 2 and 40, the number of steps required to reach x=2 are:")
   (map (lambda (n)
	  (x-paragraph n " : " (length (wind-down n))))
	(iota 41 2))

The function:

f(x) = x/2 for even x, 3x + 1 for odd x

has unpredictable behavior when applied recursively.

For x_0 = 21, the values are:

21 64 32 16 8 4 2

But for x_0 = 27, the values are:

27 82 41 124 62 31 94 47 142 71 214 107 322 161 484 242 121 364 182 91 274 137 412 206 103 310 155 466 233 700 350 175 526 263 790 395 1186 593 1780 890 445 1336 668 334 167 502 251 754 377 1132 566 283 850 425 1276 638 319 958 479 1438 719 2158 1079 3238 1619 4858 2429 7288 3644 1822 911 2734 1367 4102 2051 6154 3077 9232 4616 2308 1154 577 1732 866 433 1300 650 325 976 488 244 122 61 184 92 46 23 70 35 106 53 160 80 40 20 10 5 16 8 4 2

For all integers between 2 and 40, the number of steps required to reach x=2 are:

2 : 1

3 : 7

4 : 2

5 : 5

6 : 8

7 : 16

8 : 3

9 : 19

10 : 6

11 : 14

12 : 9

13 : 9

14 : 17

15 : 17

16 : 4

17 : 12

18 : 20

19 : 20

20 : 7

21 : 7

22 : 15

23 : 15

24 : 10

25 : 23

26 : 10

27 : 111

28 : 18

29 : 18

30 : 18

31 : 106

32 : 5

33 : 26

34 : 13

35 : 13

36 : 21

37 : 21

38 : 21

39 : 34

40 : 8

Problem 1.3

(x-paragraph #f "Now is the time")
	  (x-paragraph #f "for all good hackers")
	  (x-paragraph #f "to come" (x-break) " to the aid")
	  (x-paragraph #f "of their"
		       (x-anchor '((href "http://mit.edu")
				   (name "the 'stvte"))
				 "institute")
		       ".")

Now is the time

for all good hackers

to come
to the aid

of their institute.

Problem 1.4-5

(x-arrange (t-row (t-column "A" (t-row "B" "C")) (t-column "D" "E" "F") "G"))

A D G
E
B C
F

Problem 1.6

The code which generated this page

The xhtml scheme functions.

Some miscellaneous library functions.