Re: [SPOILER] Re: Perl Quiz of the Week #25 (RPN calculator)
Jon Ericson <[email protected]> Wed, 06 Oct 2004 17:40:11 -0700
| Newsgroups | gmane.comp.lang.perl.qotw.discuss |
|---|---|
| Organization | I speak for myself; not JPL, NASA nor the US Government |
| Message-ID | <[email protected]> |
Mark Jason Dominus <[email protected]> writes: > In PostScript you define a procedure by doing something like: > > { 2 mul } /double def > > After processing the '}' operator, the stack contains an anonymous > function. '/double' pushes the "name object" representing the name > "double", and then "def" is a binary operator which expects a name and > a value and associates the two in the current dictionary. I extended my calculator with this type of function definition and it is now possible to define 'tan' using only the operators specified in the original quiz. There are a number of other functions that are interesting to define if you remember (or look up ;-) the trigonometric identities. Jon