| | Re: A recursion question/test... JR Conlin
|
| | (...) Well, you didn't specify if the numbers existed in a list or were iterative, and you didn't specify language so: Smalltalk: ^list sum. or ^(1..n) sum. sorry.. if you'll excuse Perl... List: foreach $num (@list) {$result += $num;} return (...) (26 years ago, 12-May-99, to lugnet.robotics)
|
| | |
| | | | Re: A recursion question/test... Eric Lind
|
| | | | I've been meaning to ask: Do you believe technology exists? It would seem hard to maintain a postition of a Techno-Atheist, given that you're using a computer to post. Just ribbing ya, sorry ;-) (...) -- Did you check the web site first?: (URL) (26 years ago, 12-May-99, to lugnet.robotics)
|
| | | | |
| | | | Re: A recursion question/test... Kekoa Proudfoot
|
| | | | (...) If you're not going to make it recursive, why not: $result = $n * ($n + 1) / 2; That is effectively the sum of all numbers from 0 to n. -Kekoa (26 years ago, 12-May-99, to lugnet.robotics)
|
| | | | |
| | | | Re: A recursion question/test... JR Conlin
|
| | | | Actually, it came from a conversation I was having about how "religious" some people are about technology. My stance was that there is no supreme hardware or software, they all suck in their own unique way. "So what you're saying is that you are a (...) (26 years ago, 13-May-99, to lugnet.robotics)
|
| | | | |