       Re: Literal

• Subject: Re: Literal
• From: uunet!cello.hpl.hp.com!jacobson
• Date: Fri, 09 Mar 90 10:33:58 PST
• Apparently-to: mathgroup-send at yoda.ncsa.uiuc.edu

```jack at sun.acs.udel.edu writes:

I want to define a function of Mathematica built-in function.  I can
do this but to evaluate it seems a little awkward.  I must be doing
something wrong!?

In:= f[Literal[Integrate[g_,x_]]]:=Integrate[g,x] + Sin[x]

r[t_]:=t^3
...
In:= f[Integrate[r[t],t]]

4
t
Out= f[--]
4

The problem has nothing to do with literal, but rather with the fact
that f[] evaluates its argument.

Since Integrate[r[t],t] evaluates to t^4/4, all f ever gets to see is
f[t^4/4], and that won't evaluate, so that is what it gives you.

If before defining f you make f have the HoldAll attribute, everything
will work fine.

----------------------
In:= SetAttributes[f,HoldAll]

In:=  f[Literal[Integrate[g_,x_]]]:=Integrate[g,x] + Sin[x]

In:= r[t_] := t^3

In:= f[Integrate[r[t],t]]

4
t
Out= -- + Sin[t]
4
---------------
-- David Jacobson

```

• Prev by Date: DSolve
• Next by Date: Re: Use of Literal
• Previous by thread: Re: Use of Literal
• Next by thread: Plotting two surfaces