you still need a stack to store program state for non tail recursive functions.
Name:
Anonymous2007-05-08 7:22 ID:AmTAHLUw
Is this relevant to the board, or is that just your way of saying 'I've read SICP'?
Name:
Anonymous2007-05-08 10:20 ID:YQSgicIX
WOW IT'S LIKE 8-BIT PROCESSORS DIDN'T USE THE STACK TO TRANSMIT PARAMETERS TO SUBROUTINES, THEY USED REGISTERS AND FIXED MEMORY LOCATIONS. HERE WE GOT 'PASS VIA STACK', A 'NEW' WAY OF DOING SHIT THAT COMES WITH THE 16-BIT CPU'S. AND LOOK, BUFFER OVERFLOWS. ZOMG SHOULD HAVE LISTED TO US 8-BIT PPL FROM THE GET GO, FPAGS.
Name:
Anonymous2007-05-08 21:30 ID:R1iWAJod
>>4
So tell me, mr. bright guy, where does the 8-bit microprocessor save those registers in your wonderful little caller-saves calling convention?
Or is it that you would eschew subprograms altogether, instead relying on jumps to fixed positions? Lol, enjoy your lack of recursion.
>>5
THIS WAS YQSgicIX
OH YEAH I FORGOT ABOUT THAT
DAMN I GOT OWNED HARD - ORZ ORZ ORZ
ANY RECURSIVE PROBLEM CAN BE SOLVED ITERATIVELY THO.
Name:
Anonymous2007-05-09 12:11 ID:8lofCkE2
>>7
Except the iterative solution generally just leads you to, except for the tail recursion case, manage stacks by hand. Still that's fundamentally true, even if "proper recursion" with function call instructions is just having the processor manage stacks for you.
Name:
Anonymous2007-05-09 12:49 ID:Y/8c2fGi
What the fuck are you talking about. Even my 25 year old 6502-based microcomputer had a stack (between 0x100 and 0x1FF). And the supplied BASIC interpreter used it, too.
Name:
Anonymous2007-05-09 14:34 ID:RhzpOd3h
>>8
Also, the iterative version generally looks like shit.
Name:
Anonymous2007-05-09 15:08 ID:Is/PZayh
LOOK
THE OLD 8-BIT COMPUTER PROGRAMS DID NOT USE THE STACK THAT MUCH TO PASS PARAMETERS
MOSTLY BECAUSE THERE WASN'T A BP TYPE REGISTER TO EXTRACT STACK FRAMES CONVENIENTLY
THEY ONLY USED IT TO SAVE THE PROGRAM COUNTER OR INSTRUCTION POINTER OR WHATEVER
MOST OF THE TIME YOU WOULD CALL KERNEL ROUTINES BY STORING VALUES IN ZERO PAGE LOCATIONS OR USING REGISTERS AND THEN JSR'ING TO THE ADDRESS, NO PHA [PARAMETER]:JSR [ROUTINE] >>7 ORZ >>10 RUNS FASTER
Name:
Anonymous2007-05-09 15:20 ID:RhzpOd3h
>>11
TAIL-CALL OPTIMIZATION, MOTHERFUCKER, DO YOU USE IT?
Name:
Anonymous2007-05-09 16:00 ID:N3oWpy/j
I love you, guys
Name:
Anonymous2007-05-09 16:45 ID:APhwag+M
>>12
how the fuck do you propose we handle exceptions when unwinding the stack if there is tail call optimisations in place?!
>>14
Because tail call elimination implies that there are no stack frames to unwind. Duh. (This is why a try-block prevents tail calling in e.g. Java.)
Name:
Anonymous2007-05-09 23:08 ID:8lofCkE2
That's not to say that Java implementations actually eliminated tailcalls where possible... I mean, they're Java runtimes, they've got Enterprise Scalability branded to their metaphorical foreheads.
>>19
Not any language. In Brainfuck even banging on the keyboard produces a program that will run.
Name:
Anonymous2007-05-10 11:46 ID:fPzljeHi
>>20
On a 6502, banging on the keyboard will also produce a program that will run. Being as there's no '\0' key on anyone sane's keyboard, there'll be no accidental BRK instructions... (I wonder what happens if you try to RTI from outside an interrupt handler though.)
Name:
Anonymous2007-05-10 12:35 ID:rH3BzBkA
>>21
There are several undocumented opcodes that will jam the CPU. Executing random garbage will likely hit one of these opcodes.
RTI does nothing more than pull .P off the stack as well as the PC. So you'll return to a unknown address with the added benefit of having your .P register contain garbage. You can even clean up a PLP:RTS pair with RTI if you're not interested in writing maintainable code.
Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
Name:
Anonymous2013-08-31 23:05
A set X is Dedekind-infinite if there exists a proper subset Y of X with |X| = |Y|, and Dedekind-finite if such a subset doesn't exist. The finite cardinals are just the natural numbers, i.e., a set X is finite if and only if |X| = |n| = n for some natural number n. Any other set is infinite. Assuming the axiom of choice, it can be proved that the Dedekind notions correspond to the standard ones. It can also be proved that the cardinal ℵ0 (aleph null or aleph-0, where aleph is the first letter in the Hebrew alphabet, represented ℵ) of the set of natural numbers is the smallest infinite cardinal, i.e. that any infinite set has a subset of cardinality ℵ0. The next larger cardinal is denoted by ℵ1 and so on. For every ordinal α there is a cardinal number ℵα, and this list exhausts all infinite cardinal numbers.
Name:
Anonymous2013-08-31 23:50
It was introduced in 1655 by John Wallis, and, since its introduction, has also been used outside mathematics in modern mysticism and literary symbology.
Name:
Anonymous2013-09-01 0:35
Perspective artwork utilizes the concept of imaginary vanishing points, or points at infinity, located at an infinite distance from the observer. This allows artists to create paintings that realistically render space, distances, and forms
Name:
Anonymous2013-09-01 1:21
Descriptive set theory is the study of subsets of the real line and, more generally, subsets of Polish spaces. It begins with the study of pointclasses in the Borel hierarchy and extends to the study of more complex hierarchies such as the projective hierarchy and the Wadge hierarchy.
Name:
Anonymous2013-09-01 2:06
For any set X of nonempty sets, there exists a choice function f defined on X.
Name:
Anonymous2013-09-01 2:51
A cause for this difference is that the axiom of choice in type theory does not have the extensionality properties that the axiom of choice in constructive set theory does.