Artifact c405fd9bbb52a6a0045e98e19ceed450e2752c3310de31853549d39bc8b986a0:
- Executable file
r37/lisp/csl/html/r37_0277.html
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 1938) [annotate] [blame] [check-ins using] [more...]
<A NAME=DEFN> <TITLE>DEFN</TITLE></A> <b><a href=r37_idx.html>INDEX</a></b><p><p> <B>DEFN</B> _ _ _ _ _ _ _ _ _ _ _ _ <B>switch</B><P> <P> <P> <P> When the switch <em>defn</em> is on, the Standard Lisp equivalent of the input statement or procedure is printed, but not evaluated. Default is <em>off</em>. <P> <P> <P> <H3> examples: </H3> <P><PRE><TT> on defn; 17/3; (AEVAL (LIST 'QUOTIENT 17 3)) df(sin(x),x,2); (AEVAL (LIST 'DF (LIST 'SIN 'X) 'X 2)) procedure coshval(a); begin scalar g; g := (exp(a) + exp(-a))/2; return g end; (AEVAL (PROGN (FLAG '(COSHVAL) 'OPFN) (DE COSHVAL (A) (PROG (G) (SETQ G (AEVAL (LIST 'QUOTIENT (LIST 'PLUS (LIST 'EXP A) (LIST 'EXP (LIST 'MINUS A))) 2))) (RETURN G)))) ) coshval(1); (AEVAL (LIST 'COSHVAL 1)) off defn; coshval(1); Declare COSHVAL operator? (Y or N) n procedure coshval(a); begin scalar g; g := (exp(a) + exp(-a))/2; return g end; COSHVAL on rounded; coshval(1); 1.54308063482 </TT></PRE><P>The above function <em>coshval</em> finds the hyperbolic cosine (c osh) of its argument. When <em>defn</em> is on, you can see the Standard Lisp equivalent of the function, but it is not entered into the system as shown by the message <em>Declare COSHVAL operator?</em>. It must be reentered with <em>defn</em> off to be recognized. This procedure is used as an example; a more efficient procedure would eliminate the unnecessary local variable with <P><PRE><TT> procedure coshval(a); (exp(a) + exp(-a))/2; </TT></PRE><P><P> <P> <P> <P>