racket/collects/htdp/Test/guess-gui.ss
Matthias Felleisen 9276a46dc4 is-end-of-world added to world
svn: r10300
2008-06-16 19:52:40 +00:00

25 lines
884 B
Scheme

;; The first three lines of this file were inserted by DrScheme. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname guess-gui) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
;; TeachPack : guess-gui.ss
;; Language: Beginning
;; ------------------------------------------------------------------------
;; model : button% event% -> true
(define (model x y)
(view (convert (list (control 0) (control 1) (control 2)))))
;; convert : (listof DIGIT) -> number
;; to convert a list of digits into a number
;; the leading digit is the least signifcant one
(define (convert alod)
(cond
[(empty? alod) 0]
[else (+ (first alod) (* 10 (convert (rest alod))))]))
;; TEST:
(connect model)