[Date Index]
[Thread Index]
[Author Index]
Re: new functional operator
*To*: mathgroup at smc.vnet.net
*Subject*: [mg125369] Re: new functional operator
*From*: Bill Rowe <readnews at sbcglobal.net>
*Date*: Sat, 10 Mar 2012 06:15:11 -0500 (EST)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
On 3/9/12 at 6:09 AM, roby.nowak at gmail.com (roby) wrote:
>Ok, next version.
>One can look for an prefix operator with no buit in meaning to
>modify the function in question such that it acts mapping, this way
>we can use the standard // postfix operator and just modify the
>behavoir of the function:
>\[Del] fn_ := fn /@ # &
>{1,2,3,4}//\[Del]f//\[Del]g
>Out[5]= {g[f[1]], g[f[2]], g[f[3]], g[f[4]]}
>(looks all nice in a Notebook)
I don't have any problem agreeing this notation looks nicer than say
{1, 2, 3, 4} // f /@ # & // g /@ # &
And, I can set up the definition in init.m so that it is always
available without needing to define it in each notebook where I
would use it.
But it presents another issue. Unless you are writing code for
yourself you will never share with someone else, you will be
making your code much more difficult to understand.
Arguably something like
f/@{1,2,3,4}
is already opaque to a new Mathematica user in terms of
understanding code. But, since this is standard syntax one could
highlight the /@ then use the built-in documentation to
determine what the code is doing. But once you start using
custom notation, this ability is lost. Then, even a well
seasoned user will have great difficulty in determining what the
code does.
And in fact, unless you use such custom notation often, you are
likely to have difficulty with your own code if you need to
review/modify it say a year or two after it was written.
Prev by Date:
**Re: much power to mathematica**
Next by Date:
**Re: Using Mathematica to typeset books**
Previous by thread:
**Re: new functional operator**
Next by thread:
**Re: new functional operator**
| |