Referenced from lesson Defining Functions
There is space below to define four different functions, writing their Contracts, two examples, and the definition itself. The function gt
- which makes solid green triangles of a given size - is provided as an example. Can you define bc
as a function which makes solid blue circles of a given radius?
Directions: gt
Contract and Purpose Statement |
Every contract has three parts…
; gt: Number->Image
; _______
Examples |
Write some examples, then circle and label what changes…
(EXAMPLE (gt 10)(triangle 10 "solid" "green"))
(EXAMPLE (gt 20)(triangle 20 "solid" "green"))
Definition |
Write the definition, giving variable names to all your input values…
(define (gt size)
__(triangle size "solid" "green"))
Directions: gold-star
Contract and Purpose Statement |
Every contract has three parts…
; _________:_______->_____
; _______
Examples |
Write some examples, then circle and label what changes…
(EXAMPLE (_________ ___)________________________)
(EXAMPLE (_________ ___)________________________)
Definition |
Write the definition, giving variable names to all your input values…
(define (_________ _______)
______________________________)
Directions: MMMMMMMMMM
Contract and Purpose Statement |
Every contract has three parts…
; __________:_->_
; _______
Examples |
Write some examples, then circle and label what changes…
(EXAMPLE (__________ ______________) ___________________________________________________)
(EXAMPLE (__________ ______________) ___________________________________________________)
Definition |
Write the definition, giving variable names to all your input values…
(define (__________ _)
____)
Directions: MMMMMMMMMM
Contract and Purpose Statement |
Every contract has three parts…
; __________:_->_
; _______
Examples |
Write some examples, then circle and label what changes…
(EXAMPLE (__________ ______________) ___________________________________________________)
(EXAMPLE (__________ ______________) ___________________________________________________)
Definition |
Write the definition, giving variable names to all your input values…
(define (__________ _)
____)
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). Bootstrap:Algebra by Emmanuel Schanzer, Jen Poole, Ed Campos Jr, Flannery Denny, and Dorai Sitaram is licensed under a Creative Commons 4.0 Unported License. Based on a work at www.BootstrapWorld.org. Permissions beyond the scope of this license may be available by contacting schanzer@BootstrapWorld.org.