Add output of a few front page examples in explanations.

This commit is contained in:
Sam Tobin-Hochstadt 2014-04-07 15:46:51 -04:00
parent c90538d249
commit a5bc367b89
3 changed files with 14 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -114,11 +114,13 @@
[(zero? n) (triangle 2 'solid 'red)]
[else (define t (sierpinski (- n 1)))
(freeze (above t (beside t t)))]))}
(list
@desc{The @elemcode{2htdp/image} library provides easy-to-use functions
for constructing images, and DrRacket can display an image result as
easily as it can display a number result. In this case, a
@elemcode{sierpinski} function is defined and called (at the same time)
to generate a Sierpinski triangle of depth 8.})
to generate a Sierpinski triangle of depth 8. It looks like}
@img[width: "50%" src: (copyfile #:site www-site (build-path img-dir "sierp.png"))]))
(graphical-example #:title "GUI Programming"; ---------------------------------------------
@code{#lang racket/gui ; A GUI guessing game
(define f (new frame% [label "Guess"]))
@ -158,14 +160,19 @@
@code{#lang racket
;; Print the Greek alphabet
(for ([i (in-range 25)])
(displayln
(display
(integer->char
(+ i (char->integer #\α)))))}
(list
@span{This prints out: }
@|br|
@elemcode{αβγδεζηθικλμνξοπρςστυφχψω}
@|br|
@desc{You can also spell @elemcode{#\α} as
@elemcode{#\u3B1} to stay within ASCII.
Fortunately, Racket and DrRacket are both
perfectly happy to use Unicode characters, and DrRacket comes
with shortcuts for inserting them.})
with shortcuts for inserting them.}))
(graphical-example #:title "Functional Animations"; ---------------------------------------------
@code{#lang htdp/bsl ; Any key inflates the balloon
(require 2htdp/image) (require 2htdp/universe)
@ -218,9 +225,11 @@
(define (thrice f) (lambda (x) (f (f (f x)))))
(plot (list (function ((thrice deriv) sin) -5 5)
(function cos -5 5 #:color 'blue)))}
(list
@desc{This program uses the @elemcode{plot} library to draw plots of
functions. Note that the plots are actual value, which DrRacket shows
in graphical form.})
functions. Note that the plots are actual values, which DrRacket shows
in graphical form. It looks like}
@img[width: "50%" src: (copyfile #:site www-site (build-path img-dir "cos-deriv.png"))]))
(generic-example #:title "Sending email"; -----------------------------------------------
@code{#lang racket ; Sending email from racket
(require net/sendmail)