Re: Pipes Inside Mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg45702] Re: Pipes Inside Mathematica?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 20 Jan 2004 05:08:12 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <bua3rl$ipr$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
and you are unable to write
{{5*Pi},{13*E}} // IntegerPart // Table[0, Extract[#,1], Extract[#,2]] &
// MatrixForm
and use a pure function ??
We need not a new programing construct,
we need user that read the manual.
Regards
Jens
Harold Noffke wrote:
>
> MathGroup:
>
> I think Mathematica would be a better programming language if it had a
> construct that allowed pipes (like Unix does). The //-mark comes
> close to facilitating this, but Mathematica needs a placeholder to
> denote "result from preceding //-mark".
>
> Here's a short example to illustrate what would be gained.
>
> In[1]:= m = 5*Pi // IntegerPart
>
> Out[1]= 15
>
> In[2]:= n = 13*E // IntegerPart
>
> Out[2]= 35
>
> In[3]:= Table[0, {m}, {n}] // MatrixForm
>
> Out[3]//MatrixForm=
>
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0
>
> > > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> : :
> : :
> : :
>
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0
>
> > 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>
> What we would really like to write is the preceding computation as a
> pipeline, so that it looks something like this ...
>
> {{5*Pi},{13*E}} // IntegerPart // Table[0, Extract[<?>,1],
> Extract[<?>,2]] // MatrixForm
>
> The <?> symbol means, "I don't know what to put here" -- it's a
> placeholder for whatever Mathematica wants to use as "result from
> preceding //-mark". Maybe @ would make a good placeholder here, and
> what we would see on screen is ...
>
> {{5*Pi},{13*E}} // IntegerPart // Table[0, Extract[@,1], Extract[@,2]]
> // MatrixForm
>
> I think Mathematica will be a better programming language if it adopts
> some sort of pipe convention.
>
> Harold