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 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