Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Recursion HALP

Name: Anonymous 2011-06-01 2:33

Hey /prog/, I must say my understanding of recursion is shit (never really dealt with recursion in all my days of writing bad code). How should I go about thinking about it?

inb4 flaming: I understand the recursive concept in some contexts, such as when it is used in a factorial function, but when it starts getting more ambiguous (say, exercise 5, ch. 2 from ANSI Common Lisp) it's ugly.

inb4 RECURSE MY ANUS

Name: Anonymous 2011-06-01 19:48

>>7
2/10 for baiting the retard.

Cripes you suck. Go fuck off. Your explanations are weak and your code examples suck dick.

Name: Anonymous 2011-06-01 19:50

>>7
And just for the record you little fucking nigger, your shit example could give people the wrong idea about how recursion could work. This is because not every fucking programming language handles recursion the same way. This is partially due to the fact that the definition of a "variable" tends to vary.

Name: Anonymous 2011-06-01 19:58

>>10
There are a couple of ways a computer could solve an unpotimised recursive problem you fucking moron.  Of coure the only way you would know something like this is if you actually read something other than SICP.

Name: Anonymous 2011-06-01 20:00

>>11
In other words you little fucking nigger, your use of the world "solve" is ambiguous in this case.

Name: Anonymous 2011-06-01 20:10

>>13
Are you this fucking stupid? Maybe you should stop giving shit advice and actually read a book. With that you fucking stupid shit, you are still being ambigous.

First off you don't specify the evaluation order. At what point and time do you actually calculate the values in the recursion? Second thing you fucking moron, you don't give a clear definition of the term "variable". Is the variable meant in the C/C++ sense or in the math sense? Finally, not every computer uses a stack.

Name: Anonymous 2011-06-01 20:19

>>15
Listen you stupid fuck. You had

(fact 5) ==> (* 5 (fact 4)) ==> (* 5 (* 4 ...))


'fact' is a fucking variable. Also evaluation order isn't the same thing and showing the entire evluation. Again, are you really this fucking stupid?

Name: Anonymous 2011-06-01 20:23

>>15
And more to the point your fucking stupid shit nigger. When you have something like....

(fact 5) ==> (* 5 (fact 4)) ==> (* 5 (* 4 ...))

At what point and time do you evaluate fact to a value? At what point and time do you multiply 5 * 4 *...? Your shit diagram doesn't really answer these questions.

Name: Anonymous 2011-06-01 20:23

er *point you fucking shit shit nigger.

Name: Anonymous 2011-06-01 20:25

*

Name: Anonymous 2011-06-01 20:30

>>20
Umm.... a function can be a variable. This happens more often than what you think you fucking moron.

Again, you are stupid. Also, showing the entire evaluation will not show you the order of evaluation. Again, at what point and time you do evaluate 'fact' to a value? At what point and time do you multiply all the numbers? Again, you don't bother to explain it. So again, until you can answer my questions, you should maybe stop giving shit advice, learn a few more programming languages, and attempt to write a compiler before you open your dumbass mouth again.

Name: Anonymous 2011-06-01 20:31

>>21
But like what I just asked the dumb nigger that was giving out the shit advice, at what point and time do you multiply? Now the whole concept of 'time' shouldn't be that foreign since SICP actually discusses this topic.

Name: Anonymous 2011-06-01 20:35

>>25
Well you uneducated nigger, you still can't answer the questions. So again, maybe you should stop giving out shit advice on something that you clearly don't understand and actually read a book.

Name: Anonymous 2011-06-01 20:36

>>25
Also, I never gave a definition to the term 'variable'.

Name: Anonymous 2011-06-01 20:44

You still haven't answered the questions. Is the variable a variable in the C/C++ sense or the math sense? You're shit diagram doesn't say. Again, for the third time, and what point and time do you evaluate fact? I don't see this in your shit diagram. Again, for the third time, what point and time do you do the multiplications? Again, your shit diagram doesn't tell.

And again, until you can answer my questions, your silence will just reaffirm my belief that you are some uneducated nigger that has never done any kind of real programming for a living.

Name: Anonymous 2011-06-01 20:56

>>30
"Therefore it could be a "C/C++" variable"

Okay, it's about time you answered the question.

"would end up as (* 5 (* 4 (* 3 (* 2 (1))))) before the evaluation of the products"

No, that isn't how it works if you define a variable in the C/C++ sense. Now before you get your panties in a bundle about this one, write a simple recursive fact program in C++ and then have it do something like the factorial of 2000! Do you get an exact number? I don't.

Name: Anonymous 2011-06-01 21:10

>>32

"Please define ``exact number''"

A number that isn't an approximation.

"What does your example have to do with variables versus functions, anyway?"

Some languages treat a function as a variable.



Again, you're confused you nigger. Something like the following...

"(* 5 (* 4 (* 3 (* 2 (1)))))"

Can have different meanings depending on the language.

"is merely a simplified representation of the stack, obtainable via iterative substitution. "

You're confusing an expression with its actual variable.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List