[comp.sys.handhelds] HP48SX APPLY function

adkins@gecko.cis.ohio-state.edu (Brian Adkins) (02/20/91)

I would appreciate help from anyone who has used the APPLY function.  It
is only documented in the command summary (as far as I can tell) and although
I'm giving it a local name and a list of expressions it gives me a bad
argument type error message.
-Brian Adkins

edp@jareth.enet.dec.com (Eric Postpischil (Always mount a scratch monkey.)) (02/20/91)

In article <88635@tut.cis.ohio-state.edu>, adkins@gecko.cis.ohio-state.edu
(Brian Adkins) writes:

>I would appreciate help from anyone who has used the APPLY function. 

It is further documented in the Programmer's Reference Manual.  Stack level 2
should contain a list of symbols.  Stack level 1 should contain a name.  E.g., {
X } 'Y' APPLY will yield 'Y(X)'.  You can also use it in algebraic syntax --
'APPLY(Y,A,B)' EVAL will give Y(A,B).


				-- edp (Eric Postpischil)
				"Always mount a scratch monkey."
				edp@jareth.enet.dec.com

rouben@math9.math.umbc.edu (Rouben Rostamian) (02/20/91)

In article <88635@tut.cis.ohio-state.edu> <adkins@gecko.cis.ohio-state.edu> writes:
>I would appreciate help from anyone who has used the APPLY function.  It
>is only documented in the command summary (as far as I can tell) and although
>I'm giving it a local name and a list of expressions it gives me a bad
>argument type error message.

Here it is:

Before:

    2:    { X Y }
    1:        'F'

After:

    1:   'F(X,Y)'

Hope this helps.  If you want to see this in the context of a
real application, send me email.

--
Rouben Rostamian                          Telephone: (301) 455-2458
Department of Mathematics and Statistics  e-mail:
University of Maryland Baltimore County   bitnet: rostamian@umbc.bitnet
Baltimore, MD 21228,  U.S.A.              internet: rouben@math9.math.umbc.edu

akcs.tasmith@hpcvbbs.UUCP (Ted A Smith) (02/21/91)

An example of usage of APPLY was asked for.  Here is the example
from the HP48 Programmers Reference (used without permission):

%%HP: T(3)A(R)F(.);
\<< \-> arg
  \<<
    CASE -3 FS?
      THEN arg ASIN
      END { 6 7 9 }
arg TYPE POS
      THEN 'APPLY(
ASin,arg)' EVAL
      END 'arg==1'
      THEN '\pi/2'
      END 'arg==-1'
      THEN '-\pi/2'
      END arg ASIN
    END
  \>>
\>>

Sto this into 'ASin', then ASin will 'know' about the two
special cases of 1 and -1...

Hope this helps