Homework 1: Warming up in Scheme

How to Design Programs: An Introduction to Programming and Computing

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
WPI CS536 (F07) Homework 1 (Scheme) CS 536 Homework 1: Warming up in Scheme Due: September 13, hardcopy in class and electronic via turnin (asgmt name hwk1 ) Assignment Goals To make sure you can write simple programs in Scheme. Exercises 1. Define the function suffixes, which consumes a list l, and produces a list of all suffixes of l. For example: (suffixes '(a b c d)) > ((a b c d) (b c d) (c d) (d) ()) 2. Develop a program isort to sort a list of numbers into increasing order. You may use any algorithm you wish (efficiency doesn't matter, but cleanliness of your solution does). 3. Define a datatype for toys. A toy is one of: a ball, which has a price a (stuffed) animal, which has a price, and an animal type (tiger, bear, etc) a robot, which has a price, a height, and whether it is programmable. 4. Develop the function bear-sale that consumes a list of toys and returns a list of toys. The returned list has the same toys as the input list, but the prices on all bears have been discounted 20%. 5.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

Homework 1: Warming up in Scheme - WPI CS536(F07 Homework...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online