Asking someone to write a factorial algorithm before he knows WTF a
factorial "is", is either insane, or the ultimate demonstration of deliberate
lack of cooperation and coordination between departments.
I feel kind of strongly about this ever since, as a student, the physics people
expected me to use mathematics that I had not been taught yet...
My condolences -- while I'd not encountered that particular problem
I did hate one aspect of a college course (was it probability?)...
Mainly because the HP-25 calculator did NOT have a built-in factorial,
and the 49-step program memory was volatile -- I had to code in the
factorial code before class, and hope the battery lasted the session.
I shall try to refrain from commenting on the concept of introducing
recursion into a first course in CS - I am too much tainted by my ability
to mentally "see" the stack growth in a small processor to be qualified
to comment.
Heh... the one saving grace of taking a CS major in a period where
the primary languages taught were FORTRAN (IV), COBOL (74), and
something close to K&K BASIC. Heck, even the assembler class followed
the FORTRAN parameter handling scheme (argument addresses copied to
static locals and used via one level of indirection) -- It would take me
some time, today, to figure out how to even create a "stack" (even the
return address was passed via a reserved register and saved locally):
call,2 sub-address
data arg1-address
data arg2-address
do-something
.
.
.
sub-address: store,2 my-return
load,9 *my-return,1 ;indexed access
store,9 param1
load,9 *my-return,2
store,9 param2
do-stuff
load,2 my-return
addimmediate,2 2 ;number of args to
adjust return
return,2
(format:
label command,register argument
*argument ;indirection
argument,x ;indexed )
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/