MathGroup Archive 2012

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

Search the Archive

Re: Question about function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg124435] Re: Question about function
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 19 Jan 2012 05:15:09 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201201181101.GAA16655@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

Attributes[xPrint] = {HoldAll, Listable};
xPrint[x_] := (Print[HoldForm[x], " =", Tab, x]);
xPrint[x_, y__] := (xPrint[x]; xPrint[y])

a = 5;
b = 6;
xPrint[a, b, Pi, a + b]

a =	5

b =	6

\[Pi] =	\[Pi]

a+b =	11

Bobby

On Wed, 18 Jan 2012 05:01:56 -0600, oversky <mailcwc at gmail.com> wrote:

> I define the following function:
>
> xPrint[x_]:=(Print[HoldForm[x]," =",Tab,x]);
> Attributes[xPrint]={HoldAll,Listable};
> a=5;
> xPrint[a]
>
> -> a =        5
>
> I want to modify this code such that it can handle multiple arguments.
> For example,
>
> a=5;
> b=6;
> xPrint[a,b]
>
> -> a =      5
> -> b =      6
>
> How do I get the argument one by one and feed it into Print[]?
>
>
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: Question about function
  • Next by Date: missing Tooltip for ArrayPlot etc. - workaround
  • Previous by thread: Re: Question about function
  • Next by thread: Re: Question about function