Article View: comp.lang.postscript
Article #3610Recursion vs. iteration
From: L. Peter Deutsch
Date: Thu, 08 Nov 1990 16:45
Date: Thu, 08 Nov 1990 16:45
11 lines
989 bytes
989 bytes
The recursive version of the GCD algorithm probably runs faster than
the iterative one because PostScript interpreters properly optimize
"tail recursion": if the last element of a procedure is another
procedure call, the interpreter does the equivalent of a jump rather
than a call and return. This is an implementation technique that has
been known in the Lisp world for close to 30 years; it is described
explicitly in footnote 4 on p. 41 of the Adobe Red Book.
L. Peter Deutsch :: Aladdin Enterprises :: P.O. box 60264, Palo Alto, CA 94306
ghost@aladdin.com | {uunet,sun,decwrl}!parcplace!aladdin!ghost | (415)329-0264
"Implementation is the sincerest form of flattery."
Technical Details
Message-ID:
<24.UUL1.3#5127@aladdin.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!parcplace!aladdin!ghostShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!parcplace!aladdin!ghost From: ghost@aladdin.com (L. Peter Deutsch) Newsgroups: comp.lang.postscript Subject: Recursion vs. iteration Message-ID: <24.UUL1.3#5127@aladdin.com> Date: 8 Nov 90 16:45:20 GMT Organization: Aladdin Enterprises, Menlo Park, CA Lines: 11