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 20:25

>>16
... 'fact' is the name of the function. It could be variable, but in a factorial, it most often is not.
And showing the entire evaluation will show you the order of evaluation.

Are you done trolling?

Name: Anonymous 2011-06-01 20:34

>>23
Again, why don't you fist F5 before repeating yourself?
Umm.... a function can be a variable.
Well done. I acknowledged this in the very post you were referencing. Observe:
It could be variable
Now, rinse and repeat for every fucking thing you decided to blurt out in your latest rambling, regardless of how many times you have repeated yourself. If you cannot find an answer, please redirect yourself to /g/ or /sci/ or something.

Name: Anonymous 2011-06-01 21:03

>>31
No, because with languages that do not bundle bigint support, it would overflow a 32-bit computer (and probably a 64-bit one too). Floating-point would have a similar story. Please define ``exact number''.
I said it was a function, and that it could (note the emphasis) be a "C/C++" variable in that you can pass it to another function as, say, a callback or something. You cannot call a "regular" variable (int, float, ...) as you would call a function. What does your example have to do with variables versus functions, anyway?

Clearly fact in >>7's example is being called as a function, not a variable ("C/C++", by which you mean Lisp) and (* 5 (* 4 (* 3 (* 2 (1))))) is merely a simplified representation of the stack, obtainable via iterative substitution.

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