by rudenoise on 7/23/14, 8:13 AM with 108 comments
by bodyfour on 7/23/14, 4:25 PM
For instance, on a PDP-8 (released some years after ALGOL) the calling convention was that the return address was written to the word of memory before the called function. This was simple, but pretty much precludes recursive calls.
These days we take for granted that the CPU will provide some sort of stack pointer that gets automatically managed by a CALL/RET instruction pair. Before that was provided in hardware, the compiler would have to do that itself. So if you decided to support recursion, you'd end up requiring a stack and adding a small cost to every function call.
Once you decide to have a stack, allowing recursion is a freebee so of course you'd include it.
by lars on 7/23/14, 6:29 PM
by juliangamble on 7/23/14, 1:17 PM
Little Schemer is without a doubt one of the best books I have ever read on the subject of recursion, and what is interesting because they never really go into a formal definition of what recursion is, as most texts on computer science try to. Instead they show the reader time and time again what recursion is, while providing a great series of rules (commandments) on how to get the most out of recursion, particually in a tail-recursive language like Scheme. http://www.amazon.com/The-Little-Schemer-4th-Edition/product...
You can read more about The Little Lisper here: http://thelittlelisper.blogspot.com.au/2010/06/little-lisper...
Or you can read about working through it in Clojure here: http://juliangamble.com/blog/2012/07/20/the-little-schemer-i...
by mark-r on 7/23/14, 7:47 PM
The machine I learned assembler on would rewrite the instruction at the start of a function with a jump instruction to return to the caller. You returned from the function by jumping back to its beginning. Recursion wasn't an option!
by PaulHoule on 7/23/14, 11:48 AM
by DonHopkins on 7/24/14, 9:27 AM
by agumonkey on 7/23/14, 12:38 PM
;;; power set = power {set-X} as sub (+.) {X U sub}
(define (power set)
(if (null? set)
'(())
(let ((sub (power (cdr set)))
(augment (lambda (subset) (cons (car set) subset))))
(append (map augment sub) sub))))
Seeking self-similarity often lead to tiny solutions.by kps on 7/23/14, 1:55 PM
> Ritchie relaxed the definition-before-use rule by allowing
> redundant declarations of procedure headings. At the
> expense of a redundant advance declaration the programmer
> can define mutually recursive procedures in C.
Point of order: C didn't have a declaration-before-use rule until C99. C had ‘implicit int’; no redundant declarations necessary.by bguthrie on 7/23/14, 2:58 PM
by michaelfeathers on 7/23/14, 7:28 PM
I imagine John McCarthy and the others who wanted recursion just sitting back and smiling, recognizing that that there was no need to press - it was just a matter of time.
by supahfly_remix on 7/23/14, 11:10 AM
by vanderZwan on 7/23/14, 11:50 AM
by mcguire on 7/23/14, 5:57 PM
My understanding was that without recursion the lambda calculus is not Turing-complete. Is that correct?
It should also be noted that recursion is a close relative of induction, an indispensable tool that is not without its own problematic history.
by capkutay on 7/24/14, 3:18 AM
by auggierose on 7/23/14, 5:47 PM
by chrisbennet on 7/23/14, 11:18 AM