Date: Fri, 23 Jan 2004 11:47:42 -0600 (CST) From: Mark Jacobson To: 810-151-05@uni.edu Subject: [810-151-05] SumOfDigits practice exercise for Monday... Scheme students, Suggested practice exercise to figure out for Monday. Write the procedure in Scheme to give you the sum of the digits in an integer. For example, 345 has sumOfDigits 12, since 3 + 4 + 5 = 12. See page 57 for the Divisibility operations in Scheme. I used modulo and quotient. See pages 93 and 211 to review thinking recursively strategies for scalar problems like sumOfDigits or Factorial and for List problems like lengthOfTheList or sumOfValuesInTheList or sortTheList. Welcome to DrScheme, version 205. Language: Intermediate Student with lambda. > (sumOfDigits 1234) 10 > (sumOfDigits 34) 7 > (sumOfDigits 807) 15 > (sumOfDigits 1234567) 28 > (sumOfDigits 12345678) 36 Homework due next Wednesday, January 28th (QUIZ ONE IS THAT DAY TOO). Page 30 Problem 1.13 (Chapter One, Problem 13). Page 74 Problems 2.8 and 2.10 (Chapter Two, Problems 8 and 10). See Figures 1.5 and 1.6 on pages 15 and 16 of the textbook for being able to draw the Data Flow Diagram of problem 1.13. Have a great weekend. Mark