CS 1102 Homework 7

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
CS 1102 Homework 7: Script Position Due: October 9 ( Tuesday ) at 11:59pm Assignment Goals To make sure you can convert programs so that all calls to scripts are in script position. Exercises To test your solutions, keep the originals in your file, copy the define-script macro from the posted class code, and make sure you get the same answer from both the original and converted code. 1. The following code prompts a user to order a pizza. Rewrite this so that order-pizza, get- toppings, and print-order all work as scripts. 2. ;; order-pizza : -> void 3. ;; prompts user for order and prints summary 4. (define (order-pizza) 5. (let ([crust (prompt-read "What style crust do you want?")]) 6. (cond [(eq? crust 'thin) 7. (print-order crust (get-toppings (list 'pepper 'onion)))] 8. [(eq? crust 'pan) 9. (print-order crust (get-toppings (list 'sausage)))]))) 10. 11. ;; get-toppings : list-of-symbol -> list-of-symbol 12. ;; prompts user for whether to include standard toppings 13. (define (get-toppings tlist)
Background image of page 1

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

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

Page1 / 2

CS 1102 Homework 7 - CS 1102 Homework 7: Script Position...

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