From ca3e7cb8c7dd55efcd822926a471867c9073bb03 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Wed, 23 Apr 2008 23:18:50 +0000 Subject: [PATCH] svn: r9441 --- collects/teachpack/htdp/Docs/arrow.thtml | 71 ------------------- collects/teachpack/htdp/Docs/draw.thtml | 0 collects/teachpack/htdp/Docs/htdp.scrbl | 6 +- collects/teachpack/htdp/Docs/index.thtml | 11 --- collects/teachpack/htdp/Docs/questions.scrbl | 57 --------------- collects/teachpack/htdp/Docs/show-queen.scrbl | 26 +++++++ collects/teachpack/htdp/Docs/show-queen.thtml | 21 ------ 7 files changed, 31 insertions(+), 161 deletions(-) delete mode 100644 collects/teachpack/htdp/Docs/arrow.thtml delete mode 100644 collects/teachpack/htdp/Docs/draw.thtml delete mode 100644 collects/teachpack/htdp/Docs/index.thtml delete mode 100644 collects/teachpack/htdp/Docs/questions.scrbl create mode 100644 collects/teachpack/htdp/Docs/show-queen.scrbl delete mode 100644 collects/teachpack/htdp/Docs/show-queen.thtml diff --git a/collects/teachpack/htdp/Docs/arrow.thtml b/collects/teachpack/htdp/Docs/arrow.thtml deleted file mode 100644 index 0065dc81d2..0000000000 --- a/collects/teachpack/htdp/Docs/arrow.thtml +++ /dev/null @@ -1,71 +0,0 @@ -{ (define LIBNAME "Arrows") - (include "head.tinc") } - -

A shape is a class of data for which move and -draw operations can be drawn.

- -

The teachpack arrow.ss implements controller for moving -shapes across a canvass. It provides three operations: -

-
  • {(idx control-left-right)} : shape number move draw -> true : - -
    It consumes a shape, a number, a move function and a - draw function. The - move function consumes a number and a shape and re-draws the shape on - some canvas and produces a shape that is translated by N pixels left or - right. -

    - -
  • {(idx control-up-down)} : shape number move -> true: - -
    It is like control-left-right but controls movements by - N pixels up or down. -

    - -
  • {(idx control)} : shape number move-lr move-ud -> true: - -
    It consumes a shape, a number, two move functions, and a - draw function. The move functions consume a number and a - shape and re-draw the shape on some canvas and produces a shape that is - translated by N pixels left or right and up or down, respectively. - -
  • - -

    Example: -

    -;; A shape is a structure:
    -;;   (make-posn num num)
    -
    -;; RAD : the radius of the simple disk moving across a canvas
    -(define RAD 10)
    -
    -;; move : number shape -> shape or false
    -;; to move a shape by delta according to translate
    -;; effect: to redraw it
    -(define (move delta sh)
    -  (cond
    -    [(and (clear-solid-disk sh RAD)
    -          (draw-solid-disk (translate sh delta) RAD))
    -     (translate sh delta)]
    -    [else false]))
    -
    -;; translate : shape number -> shape
    -;; to translate a shape by delta in the x direction
    -(define (translate sh delta)
    -  (make-posn (+ (posn-x sh) delta) (posn-y sh)))
    -
    -;; draw-it : shape -> true
    -;; to draw a shape on the canvas: a disk with radius
    -(define (draw-it sh)
    -  (draw-solid-disk sh RAD))
    -
    -;; TESTS:
    -
    -;; this creates the canvas
    -(start 100 50)
    -
    -;; this creates the controller GUI
    -(control-left-right (make-posn 10 20) 10 move draw-it)
    -
    - -{(include "foot.tinc")} diff --git a/collects/teachpack/htdp/Docs/draw.thtml b/collects/teachpack/htdp/Docs/draw.thtml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/collects/teachpack/htdp/Docs/htdp.scrbl b/collects/teachpack/htdp/Docs/htdp.scrbl index 5f4567685d..e59097b750 100644 --- a/collects/teachpack/htdp/Docs/htdp.scrbl +++ b/collects/teachpack/htdp/Docs/htdp.scrbl @@ -22,10 +22,14 @@ @include-section["gui.scrbl"] @include-section["arrow-gui.scrbl"] @include-section["elevator.scrbl"] +@include-section["show-queen.scrbl"] + +@;-- what do those do? -- @;include-section["guess-gui.scrbl"] +@;include-section["lkip-gui.scrbl"] @;include-section["Simplified Scheme Web Servlets"] @;include-section["Scheme Web Servlets"] -@;include-section["queen.scrbl"] + diff --git a/collects/teachpack/htdp/Docs/index.thtml b/collects/teachpack/htdp/Docs/index.thtml deleted file mode 100644 index 84c713a800..0000000000 --- a/collects/teachpack/htdp/Docs/index.thtml +++ /dev/null @@ -1,11 +0,0 @@ - - -Teachpacks for How to Design Programs - - -

    Teachpacks for How to Design Programs

    - - - -{(include "foot.tinc")} diff --git a/collects/teachpack/htdp/Docs/questions.scrbl b/collects/teachpack/htdp/Docs/questions.scrbl deleted file mode 100644 index 9c28f091b9..0000000000 --- a/collects/teachpack/htdp/Docs/questions.scrbl +++ /dev/null @@ -1,57 +0,0 @@ -#lang scribble/doc - -@(require scribble/manual - (for-label scheme/base)) - -@title[#:tag "questions"]{Questions concerning scribble} - -Here are my questions. Feel free to point me to specific pieces of - documentations. As a matter of fact, I'd almost prefer that. - -@itemize{ - -@item{ - world.ss imports image.ss and re-exports all the bindings. - - So in world.scrbl, I have to require @scheme[(for-label "world.ss")] but - when I do so, I don't get bindings for functions from - @scheme[image.ss]. - - If I require @scheme[(for-label "image.ss")] in addition, I get an - import conflict. What is the proper solution? -} - -@item{ - I'd like to make graphical examples. I looked at the "quick" guide to - see how you do this, but I can't figure out how to run all this under - mred's control. -} - -@item{ - For the teachpack definitions, I like to spell out data definitions like - in HowToDesign. For example, - - -;; {Mode} is one of the following two symbols or strings: - -;; -- @scheme['solid] - -;; -- @scheme['outline] - -;; -- @scheme["solid"] - -;; -- @scheme["outline"] - - I want the two semi-colons, I want the scheme mode for the constants, - and I want the first part to look like an ordinary test line. - [slatex and thtml do this for me] - - I would also like to use @scheme[Mode] as if it were some exported - variable so that I can jump to its definition from other places in the - documentation. But I also don't want to introduce a (fake) visible - definition. I don't think deftech and defterm are the right tools. But - perhaps that's all there is to it. - -} - -} diff --git a/collects/teachpack/htdp/Docs/show-queen.scrbl b/collects/teachpack/htdp/Docs/show-queen.scrbl new file mode 100644 index 0000000000..b0d9a88a02 --- /dev/null +++ b/collects/teachpack/htdp/Docs/show-queen.scrbl @@ -0,0 +1,26 @@ +#lang scribble/doc + +@(require scribble/manual + (for-label scheme + teachpack/htdp/show-queen)) + +@title[#:tag "show-queen"]{8 Queens: show-queen.ss} + +@declare-exporting[teachpack/htdp/show-queen] + +The teachpack provides the operation @scheme[show-queen], which implements +a GUI for exploring the n-queens problem. + +@defproc[(show-queen [board (list-of (list-of boolean?))]) true]{The +function @scheme[show-queen] consumes a list of +lists of booleans that describes a @scheme[board]. Each of the inner +lists must have the same length as the outer list. The +@scheme[true]s correspond to positions where queens are, +and the @scheme[false]s correspond to empty squares. The +function returns nothing. + +In the GUI window that @scheme[show-queen] opens, the +red and orange dots show where the queens are. The green dot +shows where the mouse cursor is. Each queen that threatens +the green spot is shown in red, and the queens that do not +threaten the green spot are shown in orange.} diff --git a/collects/teachpack/htdp/Docs/show-queen.thtml b/collects/teachpack/htdp/Docs/show-queen.thtml deleted file mode 100644 index 178f7b00da..0000000000 --- a/collects/teachpack/htdp/Docs/show-queen.thtml +++ /dev/null @@ -1,21 +0,0 @@ -{ (define LIBNAME "Show Queen") - (include "head.tinc") } - -

    The teachpack show-queen.ss provides the -operation {(idx show-queen)}. It implements a GUI for -exploring the n-queens problem.

    - -

    The function show-queen consumes a list of -lists of booleans that describes a board. Each of the inner -lists must have the same length as the outer list. The -trues correspond to positions where queens are, -and the falses correspond to empty squares. The -function returns nothing. - -

    In the GUI window that show-queen opens, the -red and orange dots show where the queens are. The green dot -shows where the mouse cursor is. Each queen that threatens -the green spot is shown in red, and the queens that do not -threaten the green spot are shown in orange. - -{(include "foot.tinc")}