[racket] why here 2 functions
On Apr 3, 2012, at 9:34 AM, Roelof Wobben wrote:
> I have to make this exercise :
>
> Design the function different. It consumes two (representations of) three-letter words and creates a word from the differences. For each position in the words, it uses the letter from the second word, if the two are the same; otherwise it uses the marker "*". Note: The problem statement mentions two different tasks: one concerning words and one concerning letters. This suggests that you design two functions.
>
> Im my opion I only need 1 function.
>
> I use a cond to check if the letters are the same and if print the letter otherwise print x .
I can imagine doing this as a single function, but I agree that it would be cleaner and more modifiable if it were done as two functions, "one concerning words and one concerning letters."
What is the contract of your 1 function?
Stephen Bloch
sbloch at adelphi.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120403/86c5f6e7/attachment.html>