| 1 | <h2>Comments</h2> |
| 2 | <pre><code>; This is a comment</code></pre> |
| 3 | |
| 4 | <h2>Booleans</h2> |
| 5 | <pre><code>#t |
| 6 | #f</code></pre> |
| 7 | |
| 8 | <h2>Strings</h2> |
| 9 | <pre><code>"two \"quotes\" within"</code></pre> |
| 10 | |
| 11 | <h2>Functions</h2> |
| 12 | <pre><code>(lambda (x) (+ x 3)) |
| 13 | (apply vector 'a 'b '(c d e)) |
| 14 | </code></pre> |
| 15 | |
| 16 | <h2>Full example</h2> |
| 17 | <pre><code>;; Calculation of Hofstadter's male and female sequences as a list of pairs |
| 18 | |
| 19 | (define (hofstadter-male-female n) |
| 20 | (letrec ((female (lambda (n) |
| 21 | (if (= n 0) |
| 22 | 1 |
| 23 | (- n (male (female (- n 1))))))) |
| 24 | (male (lambda (n) |
| 25 | (if (= n 0) |
| 26 | 0 |
| 27 | (- n (female (male (- n 1)))))))) |
| 28 | (let loop ((i 0)) |
| 29 | (if (> i n) |
| 30 | '() |
| 31 | (cons (cons (female i) |
| 32 | (male i)) |
| 33 | (loop (+ i 1))))))) |
| 34 | |
| 35 | (hofstadter-male-female 8)</code></pre> |