Prefix notation
- To: mathgroup at smc.vnet.net
- Subject: [mg40530] Prefix notation
- From: Dr Bob <majort at cox-internet.com>
- Date: Wed, 9 Apr 2003 01:33:49 -0400 (EDT)
- References: <200304081958.h38JwTnN029958@kinglet.rentec.com>
- Reply-to: majort at cox-internet.com
- Sender: owner-wri-mathgroup at wolfram.com
>> You make judicious use of what I guess is "infix" notation. >> Maybe you're minimizing the number of keystrokes one uses. It's actually called prefix notation. I just discovered functions called Infix, Prefix, and Postfix whose help entries make this clear. I like "@" when there's only one argument because, when I see "[", it's often hard to tell where the matching "]" is, and vice-versa. If I avoid some brackets by using "@" or "//", that makes it easier to visually match the remaining brackets, and "@" does save a keystroke, after all. I generally don't like "//", but it's handy for applying a function of one argument to a long and complicated mess. Sometimes, if the argument needs parentheses, I use f[arg] instead of f@(arg). I tend to use [] if there may be other arguments added later, even though there's only one argument at the moment. Evaluate the following: parabola[zero_] := (# - zero)^2 & parabola@3 parabola[3][x] parabola[3]@x parabola@3@x (parabola@3)@x x // parabola@3 (3 // parabola)@x 3 // parabola // x -- and you'll see that evaluation order might not be what we want or expect sometimes. In this example, I think "parabola[3]@x" might be easiest to read and write. I often use my patented (not really) "multi-click" method to decide what the evaluation order will be. In x // parabola@3, for instance, click three or four times in "parabola" and you'll see the selection expand (under Windows, anyway) in a way that corresponds to evaluation order. The "multi-click" method works for finding matching brackets too, if you already have them where they belong. Prefix notation helps me get them right, by eliminating some. Bobby On Tue, 8 Apr 2003 15:58:29 -0400 (EDT), Stewart Mandell <stewart at rentec.com> wrote: > > thanks for pointing out ComplexExpand to me. > > You answer lots of queries on the Mathematica NewsGroup. > You make judicious use of what I guess is "infix" notation. > Maybe you're minimizing the number of keystrokes onw uses. > I have to get use to this. > > regards, Stewart > -- majort at cox-internet.com Bobby R. Treat