User Tools

Site Tools


cs330_f2016:racketlists

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
cs330_f2016:racketlists [2018/09/13 22:07]
morse
cs330_f2016:racketlists [2019/09/09 16:05]
morse
Line 62: Line 62:
 For example, ''​(convert (list 1 2 3))''​ should return the number 321. For example, ''​(convert (list 1 2 3))''​ should return the number 321.
  
-For your own learning, try not to write this using ''​string->​number''​. ​In fact, don't use strings at all--try to do the calculation mathematicallyFor semesters after F18this will not be allowed.+You may not use ''​string->​number'' ​or any other string-handling functions for this Avoid using strings at all
 + 
 +Hint: Don'​t ​try to figure out what position each digit is in as you process ​the list. (I.e., don't worry about "​hundreds place",​ "tens place",​ etc.). Can you figure out how to write the conversion with a more straightforward recursion? ​ What should recursing on the rest of the list return if the function works correctly? ​ What's the relationship between that and the first thing in the list that will give you the correct result?
  
 === duple === === duple ===
Line 137: Line 139:
  
 You may use auxiliary or helper functions as needed. ​ For many of these the simplest solution is to use multiple functions instead of trying to cram it all through one recursive pass through the list.  You might also have to recurse through the list multiple times, in which case it's easiest to use separate functions. You may use auxiliary or helper functions as needed. ​ For many of these the simplest solution is to use multiple functions instead of trying to cram it all through one recursive pass through the list.  You might also have to recurse through the list multiple times, in which case it's easiest to use separate functions.
- 
  
  
cs330_f2016/racketlists.txt · Last modified: 2021/06/30 23:42 (external edit)