Author |
Message |
x-ecutioner
|
Posted: Fri Mar 27, 2009 9:07 pm Post subject: math topic arranging to descending |
|
|
hi guys
im learning scheme
one of the excercises is to:
Define the program convert3. It consumes three digits, starting with the least significant digit, followed by the next most significant one, and so on. The program produces the corresponding number. For example, the expected value of
(convert3 1 2 3)
is 321.
im googling away but any ideas?
bare in mind they waant it algebraically.
i havent learnt anything so far (as in like conditional statements or loops). its actaully the first page on basic constants.
thanks. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Prabhakar Ragde
|
Posted: Sat Mar 28, 2009 7:06 am Post subject: RE:math topic arranging to descending |
|
|
I'd prefer not to see solutions to HtDP problems posted here, please.
I would also advise you to not Google for answers. The point is not to write down the answer, or to look at a correct answer and understand it. The point is to go through the exercise of figuring out the answer yourself.
In this case, you have to compute the number 321 (three hundred and twenty one) from the individual numbers 1, 2, 3, in a general fashion. So your function will look like
(define (convert3 a b c)
...)
where you fill in the ... with some expression involving a,b,c.
That's not too hard, if you think about it. |
|
|
|
|
|
x-ecutioner
|
Posted: Sat Mar 28, 2009 10:38 pm Post subject: RE:math topic arranging to descending |
|
|
oh i didnt know
im not arguging
but more out of curiousity, why is posting the problem considered objectionable?
ill look into your advice though thanks:)
i tried figuring it out myself for quite some time
i didnt tihnk itd hurt if i got help online and learn from this experience |
|
|
|
|
|
Tony
|
Posted: Sat Mar 28, 2009 11:53 pm Post subject: Re: RE:math topic arranging to descending |
|
|
x-ecutioner @ Sat Mar 28, 2009 10:38 pm wrote: but more out of curiousity, why is posting the problem considered objectionable?
Posting problems is not objectionable; the solutions are.
Prabhakar Ragde @ Sat Mar 28, 2009 7:06 am wrote: The point is not to write down the answer, or to look at a correct answer and understand it. The point is to go through the exercise of figuring out the answer yourself. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Prabhakar Ragde
|
Posted: Sun Mar 29, 2009 7:06 am Post subject: RE:math topic arranging to descending |
|
|
It's fine to ask for help here.
I just wanted to make it clear (not just to you, but to everyone reading) that the help offered should be in the form of a gentle hint and not a complete solution.
It's typically hard to get gentle hints by Googling, which is why I don't think it's a good idea if the goal is to teach yourself something. |
|
|
|
|
|
zero-impact
|
Posted: Sun Mar 29, 2009 6:09 pm Post subject: RE:math topic arranging to descending |
|
|
Try thinking about the ones column, the tens column etc.. |
|
|
|
|
|
saltpro15
|
Posted: Sun Mar 29, 2009 8:03 pm Post subject: RE:math topic arranging to descending |
|
|
quick question : I've heard scheme is taught at the first year of Waterloo CS/SE . Is this correct? |
|
|
|
|
|
Prabhakar Ragde
|
Posted: Sun Mar 29, 2009 9:38 pm Post subject: RE:math topic arranging to descending |
|
|
More so in CS (in fact for everyone in the Faculty of Math). The SE coverage is pretty minimal. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
wtd
|
Posted: Sun Mar 29, 2009 10:15 pm Post subject: Re: RE:math topic arranging to descending |
|
|
saltpro15 @ Mon Mar 30, 2009 9:03 am wrote: quick question : I've heard scheme is taught at the first year of Waterloo CS/SE . Is this correct?
And it's a wonderful thing. |
|
|
|
|
|
wtd
|
Posted: Sun Mar 29, 2009 10:23 pm Post subject: Re: RE:math topic arranging to descending |
|
|
zero-impact @ Mon Mar 30, 2009 7:09 am wrote: Try thinking about the ones column, the tens column etc..
Listen to this. Zero-impact's giving you good advice. |
|
|
|
|
|
wtd
|
Posted: Sun Mar 29, 2009 10:24 pm Post subject: Re: math topic arranging to descending |
|
|
x-ecutioner @ Sat Mar 28, 2009 10:07 am wrote: hi guys
i havent learnt anything so far (as in like conditional statements or loops). its actaully the first page on basic constants.
Good. Scheme doesn't have conditional statements or procedural loops. |
|
|
|
|
|
Prabhakar Ragde
|
Posted: Mon Mar 30, 2009 5:38 am Post subject: RE:math topic arranging to descending |
|
|
Don't frighten him. |
|
|
|
|
|
|