Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8012

Re: Question about function

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Question about function
Date 2012-01-19 10:20 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jf8qq6$3r5$1@smc.vnet.net> (permalink)
References <201201181101.GAA16655@smc.vnet.net>

Show all headers | View raw


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@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@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Question about function DrMajorBob <btreat1@austin.rr.com> - 2012-01-19 10:20 +0000

csiph-web