(module rev (lib "run.ss" "slideshow") (define cons-cell-size (* 2 (max (pict-width (t "1")) (pict-height (t "1"))))) (define arrow-size 10) (define (num x) (t (format "~a" x))) (define one (num 1)) (define two (num 2)) (define three (num 3)) (define four (num 4)) (define five (num 5)) (define (make-dot) (disk 12)) (define (cons-cell x y) (linewidth 2 (hc-append (frame (cc-superimpose (blank cons-cell-size) x)) (frame (cc-superimpose (blank cons-cell-size) y))))) (define U (t "U")) (define d1 (make-dot)) (define d2 (make-dot)) (define d3 (make-dot)) (define d4 (make-dot)) (define d5 (make-dot)) (define c1 (cons-cell one d1)) (define c2 (cons-cell two d2)) (define c3 (cons-cell three d3)) (define c4 (cons-cell four d4)) (define c5 (cons-cell five d5)) (define no-U-line (ht-append U (blank 100) (vc-append 40 c1 c2 c3 c4 c5))) (define main (cc-superimpose no-U-line (linewidth 3 (add-arrow-line arrow-size (ghost no-U-line) U find-rc c1 find-lc)))) (define (down-link d c) (linewidth 3 (add-arrow-line arrow-size (ghost main) d find-cc c find-ct))) (define (up-link d c) (linewidth 3 (add-arrow-line 10 (ghost main) d find-cc c find-cb))) (slide (vc-append (t "In-place reversal of") (t "a list bound to U"))) (slide (cc-superimpose main (down-link d1 c2) (down-link d2 c3) (down-link d3 c4) (down-link d4 c5))) (slide (cc-superimpose main (down-link d2 c3) (down-link d3 c4) (down-link d4 c5))) (slide (cc-superimpose main (up-link d2 c1) (down-link d3 c4) (down-link d4 c5))) (slide (cc-superimpose main (up-link d2 c1) (up-link d3 c2) (down-link d4 c5))) (slide (cc-superimpose main (up-link d2 c1) (up-link d3 c2) (up-link d4 c3))) (slide (cc-superimpose main (up-link d2 c1) (up-link d3 c2) (up-link d4 c3) (up-link d5 c4))))