Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: rhs of SetDelayed

  • To: mathgroup at
  • Subject: [mg1607] Re: rhs of SetDelayed
  • From: withoff (David Withoff)
  • Date: Tue, 4 Jul 1995 02:48:34 -0400
  • Organization: Wolfram Research, Inc.

In article <3stisq$oee at> c7081naa at (Michael Probst) writes:
>Hi !
>I have the following question:
>I have to define a few functions that take the same arguments.
>Therefore I don't want to write the list of agguments repeatedly
>and use a variable instead.
>The following approach:
>does not work. The left side is o.k. but since rhsArg is not
>converted to {a1,a2,a3,a4} the right side is not.
>How does one do this ?
>Thanks a lot !
>michael.probst at

You'll need to force evaluation of the selected part of the
right-hand side of the assignment before the assignment is
evaluated.  There are about a dozen ways to do this.  Here
is one of my favorites.

In[1]:= lhsArg={a1_,a2_,a3_,a4_};

In[2]:= rhsArg={a1,a2,a3,a4};

In[3]:= ((f[lhsArg]:=g[#]) &)[rhsArg]

In[4]:= ?f

f[{a1_, a2_, a3_, a4_}] := g[{a1, a2, a3, a4}]

Dave Withoff
Research and Development
Wolfram Research

  • Prev by Date: How to draw OUTLINES on 3D shapes?
  • Next by Date: Crossreference, code documentation
  • Previous by thread: Re: rhs of SetDelayed
  • Next by thread: Re: rhs of SetDelayed