473,554 Members | 2,949 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Xah's Edu Corner: The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully Functional Notations

The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully
Functional Notations

Xah Lee, 2006-03-15

Let me summarize: The LISP notation, is a functional notation, and is
not a so-called pre-fix notation or algebraic notation.

Algebraic notations have the concept of operators, meaning, symbols
placed around arguments. In algebraic in-fix notation, different
symbols have different stickiness levels defined for them. e.g.
“3+2*5>7” means “(3+(2*5))>7 . The stickiness of operator
symbols are normally called “Operator Precedence”. It is done by
giving a order specification for the symbols, or equivalently, give
each symbol a integer index, so that for example if we have
“a⊗b⊙c” , we can unambiguously understand itto mean one of
“(a⊗b)⊙c or “a⊗(b⊙c) .

In a algebraic post-fix notation known as Polish Notation, there needs
not to have the concept of Operator Precedence. For example, the in-fix
notation “(3+(2*5))>7 is written as “3 2 5 * + 7 >”, where the
operation simply evaluates from left to right. Similarly, for a pre-fix
notation syntax, the evaluation goes from right to left, as in “> 7+
* 5 2 3”.

While functional notations, do not employ the concept of Operators,
because there is no operators. Everything is a syntactically a
“function”, written as f(a,b,c...). For example, the same
expression above is written as “>( +(3, *(2,5)), 7)” or
“greaterThan( plus(3, times(2,5)), 7)”.

For lisps in particular, their fully functional notation is
historically termed sexp (short for S-Expression, where S stands for
Symbolic). It is sometimes known as Fully Parenthesized Notation. For
example, in lisp it would be (f a b c ...). In the above example it is:
“(> (+ 3 (* 2 5)) 7)”.

The common concepts of “pre-fix, post-fix, in-fix” are notions in
algebraic notations only. Because in Full Functional Notation, there is
no concept of where one places the “operator” or function. There is
always just a single position given with explicitly enclosed arguments.

Another way to see that lisp notation are not “pre” anything, is by
realizing that the “head” f in (f a b c) can be defined to be
placed anywhere. e.g. (a b c f) or even (a f b c), and it's still not
pre- or in- or post- anything. For example, in the language
Mathematica, f(a b c) would be written as f[a,b,c] where the argument
enclosure symbols is the square bracket instead of parenthesis, and
argument separator is comma instead of space, and the function symbol
(or head) is placed in outside and in front of the argument enclosure
symbols.

The reason for the misconception that lisp notations are “pre-fix”
is because the head appears before the enclosed arguments. Such
“pre-fix” has no signifance in Full Functional Notation systems and
can only engender confusion in the Algebraic Pre-fix Notation systems
where the term has significance.

2000-02-21

The common name for the lisp way is Fully Parenthesized Notation. This
syntax is the most straightforward to represent a tree, but it's not
the only choice. For example, one could have Fully Parenthesized
Notation by simply moving the semantics of the first element to the
last. You write (arg1 arg2 ... f) instead of the usual (f arg1 arg2).

Like wise, you can essentially move f anywhere and still make sense. In
Mathematica, they put the f in front of the paren, and use square
brackets instead. e.g. f[a,b,c], Sin[3], Map[f,list] ... etc. The f in
front of parent makes better conventional sense until f is itself a
list which then we'll see things like f[a,b][c, g[3,h]] etc. It's worse
when there are arbitrary nesting of heads.

A pre-fix notation in Mathematica is represented as “f@arg”.
Essentially, a pre-fix notation in this context limits it to uses for
function that has only one argument. More example: “f@a@b@c” is
equivalent to “f[a[b[c]]]” or in lispy “(f (a (b c)))”. A
post-fix notation is similar. In Mathematica it is, e.g.
“c//b//a//f”. For example “List[1,2,3]//Sin” is syntactically
equivalent to “Sin[List[1,2,3]]” or “Sin@List[1,2,3]”. (and
they are semantically equivalent to “Map[Sin, List[1,2,3]]”in
Mathematica) For in-fix notation, the function symbol is placed between
its arguments. In Mathematica, the generic form for in-fix notation is
by sandwiching the tilde symbol around the function name. e.g.
“Join[List[1,2],List[3,4]]” can be written as “List[1,2] ~Join~
List[3,4]”.

In general, when we say C is a in-fix notation language, we don't mean
it's strictly in-fix but the situation is one-size-fits-all for
convenience. Things like “i++”, “++i”, “for(;;)”, 0x123,
“sprint(...%s ...,...)”, ... are syntax whimsies. (that is, a ad hoc
syntax soup)

In Mathematica for example, there is quite a lot syntax sugars beside
the above mentioned systimatic constructs. For instance, Plus[a,b,c]
can be written in the following ways: “(a+b)+c” or “a+b+c” or
“(a+b)~Plus~c ”

The gist being that certain functions such as Plus is assigned a
special symbol '+' with a particular syntax form to emulate the
irregular and inefficient but nevertheless well-understood conventional
notation. For another example: Times[a,b] can be also written as
“a*b” or just “a b”. Mathematica also have C language's
convention of “i++”, “++i”, “i+=1” for examples.

As a side note, the Perl mongers are proud of their slogan of There Are
More Than One Way To Do It in their gazillion ad hoc syntax sugars but
unaware that in functional languages (such as Mathematica, Haskell,
Lisp) that there are consistent and generalized constructs that can
generate far far more syntax variations than the ad hoc prefixed Perl
both in theory AND in practice. (in lisps, their power syntax variation
comes in the guise of macros.) And, more importantly, Perlers clamor
about Perl's “expressivene ss” more or less on the useless syntax
level but don't realize that semantic expression is what's really
important.
----
This post is archived at:
http://xahlee.org/UnixResource_dir/writ/notations.html

Xah
xa*@xahlee.org
http://xahlee.org/

Mar 16 '06 #1
23 3597
On 15 Mar 2006 22:20:52 -0800, "Xah Lee" <xa*@xahlee.org > wrote,
quoted or indirectly quoted someone who said :
e. For example, the in-fix
notation =E2=80=9C(3+(2* 5))>7=E2=80=9D is written as =E2=80=9C3 2 5 * + 7 >=
=E2=80=9D, where the


Not that Mr. Lee has ever shown much interest in feedback, but you
pretty well have stick to vanilla ASCII to get your notation through
unmangled on newsgroups.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Mar 16 '06 #2
"""Not that Mr. Lee has ever shown much interest in feedback, but you
pretty well have stick to vanilla ASCII to get your notation through
unmangled on newsgroups."""

It is the 21st century, so having to do that oughta inspire some sort
of well earned anti Unix rant...

:)

Mar 16 '06 #3
SamFeltus wrote:
"""Not that Mr. Lee has ever shown much interest in feedback, but you
pretty well have stick to vanilla ASCII to get your notation through
unmangled on newsgroups."""

It is the 21st century, so having to do that oughta inspire some sort
of well earned anti Unix rant...

:)


Not anti-Unix.
Anti-failure-to-use-appropriate-datatypes-for-the-task-at-hand.
Mar 16 '06 #4
Xah Lee wrote:
« The Concepts and Confusions of Pre-fix, In-fix, Post-fix and Fully
Functional Notations
http://xahlee.org/UnixResource_dir/writ/notations.html »

A side note: the terminology “Algebraic” Notation is a misnomer. It
seems to imply that such notations have something to do with the branch
of math called algebra while other notation systems do not. The reason
the name Algebraic Notation is used because when the science of algebra
was young, around 1700s mathematicians are dealing with equations using
symbols like “+ × =” written out similar to the way we use them
today. This is before the activities of systimatic investigation into
notation systems as necessitated in the studies of logic in 1800s or
computer languages in 1900s. So, when notation systems are actually
invented, the conventional way of infixing “+ × =” became known as
algebraic because that's what people think of when seeing them.

Xah
xa*@xahlee.org
http://xahlee.org/

Mar 17 '06 #5

Roedy Green wrote:
On 15 Mar 2006 22:20:52 -0800, "Xah Lee" <xa*@xahlee.org > wrote,
quoted or indirectly quoted someone who said :
e. For example, the in-fix
notation =E2=80=9C(3+(2* 5))>7=E2=80=9D is written as =E2=80=9C3 2 5 * + 7 >=
=E2=80=9D, where the
Not that Mr. Lee has ever shown much interest in feedback, but you
pretty well have stick to vanilla ASCII to get your notation through
unmangled on newsgroups.


Hmmm... it displays fine via google groups. Maybe it's the reader which
is 'non-compliant' ?

Fuzzyman
http://www.voidspace.org.uk/python/index.shtml
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.


Mar 17 '06 #6
Roedy Green wrote:
On 15 Mar 2006 22:20:52 -0800, "Xah Lee" <xa*@xahlee.org > wrote,
quoted or indirectly quoted someone who said :
e. For example, the in-fix
notation =E2=80=9C(3+(2* 5))>7=E2=80=9D is written as =E2=80=9C3 2 5 * + 7 >=
=E2=80=9D, where the


Not that Mr. Lee has ever shown much interest in feedback, but you
pretty well have stick to vanilla ASCII to get your notation through
unmangled on newsgroups.


That would be one of my last concerns with Mr. Lee's postings.

If only someone could persuade this guy to stay away from CS...

Mar 17 '06 #7
Fuzzyman schrieb:
Roedy Green wrote:
On 15 Mar 2006 22:20:52 -0800, "Xah Lee" <xa*@xahlee.org > wrote,
quoted or indirectly quoted someone who said :
e. For example, the in-fix
notation =E2=80=9C(3+(2* 5))>7=E2=80=9D is written as =E2=80=9C3 2 5 * + 7 >=
=E2=80=9D, where the

Not that Mr. Lee has ever shown much interest in feedback, but you
pretty well have stick to vanilla ASCII to get your notation through
unmangled on newsgroups.


Hmmm... it displays fine via google groups. Maybe it's the reader which
is 'non-compliant' ?

Other charsets than US-ASCII are widely accepted in non-english
newsgroups as long as the charset is properly declared.

Xah's posting was properly encoded and will display fine in every decent
newsreader.
Timo
Mar 17 '06 #8
In comp.lang.perl. misc Timo Stamm <ti********@arc or.de> wrote:
Fuzzyman schrieb:
Roedy Green wrote:
On 15 Mar 2006 22:20:52 -0800, "Xah Lee" <xa*@xahlee.org > wrote,
quoted or indirectly quoted someone who said :

e. For example, the in-fix
notation =E2=80=9C(3+(2* 5))>7=E2=80=9D is written as =E2=80=9C3 2 5 * + 7 >=
=E2=80=9D, where the
Not that Mr. Lee has ever shown much interest in feedback, but you
pretty well have stick to vanilla ASCII to get your notation through
unmangled on newsgroups.
Hmmm... it displays fine via google groups. Maybe it's the reader which
is 'non-compliant' ?
Other charsets than US-ASCII are widely accepted in non-english
newsgroups as long as the charset is properly declared. Xah's posting was properly encoded and will display fine in every decent
newsreader.


It is not just the question of the newsreader, it is also a question of whether
the character set/font being used is capable of displaying the characters
concerned.

Axel

Mar 17 '06 #9
ax**@white-eagle.invalid.u k schrieb:
In comp.lang.perl. misc Timo Stamm <ti********@arc or.de> wrote:
Other charsets than US-ASCII are widely accepted in non-english
newsgroups as long as the charset is properly declared.

Xah's posting was properly encoded and will display fine in every decent
newsreader.


It is not just the question of the newsreader, it is also a question of whether
the character set/font being used is capable of displaying the characters
concerned.


A character set doesn't display characters, it specifies the coupling of
a character (grapheme) and its representation in a data format (number).

Because the specification of internet text messages only allows 7 bit
ASCII, Multipurpose Internet Mail Extensions have been introduced. They
define, for example, the quoted-printable transfer encoding.

Xah's posting properly declared a quoted-printable transfer encoding and
the UTF-8 charset. There were no unspecified characters in the message,
it was absolutely adhering to the recognized standards.
If this message doesn't display properly on your system - because your
newsreader doesn't know how to decode quoted printable or because your
operating system lacks a font to display the characters, this may be a
problem. But it's your newsreader or your OS that is broken or not up to
date.

BTW, the newsreader you are using should handle the posting fine.
Timo
Mar 17 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2493
by: Xah Lee | last post by:
the Journey of Foreign Characters thru Internet Xah Lee, 20051101 There's a bunch of confusions about the display of non-ascii characters such as the bullet "•". These confusions are justifiable, because the underlying stuff is technology, computing technologies, are in a laymen sense, extremely complex. In order to be able to type...
0
1011
by: Xah Lee | last post by:
Recommended: Sophie's World, by Jostein Gaarder, 1995. http://en.wikipedia.org/wiki/Sophie%27s_World http://www.amazon.com/gp/product/0425152251/ Xah xah@xahlee.org ∑ http://xahlee.org/
102
6981
by: Xah Lee | last post by:
i had the pleasure to read the PHP's manual today. http://www.php.net/manual/en/ although Pretty Home Page is another criminal hack of the unix lineage, but if we are here to judge the quality of its documentation, it is a impeccability. it has or possesses properties of:
14
1875
by: Xah Lee | last post by:
sometimes in the last few months, apparently Microsoft made changes to their JavaScript documentation website: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/1e9b3876-3d38-4fd8-8596-1bbfe2330aa9.asp so that, one has to goddamn press the "expand" button to view the documentation, for every goddamn page. ...
6
487
by: Xah Lee | last post by:
Sometimes you want your text to flow into multiple columns, as in newspaper's layout. However, as of 2005-12 this is not yet possible. One can make-do by hard-coding it into HTML TABLE using multiple columns. It is a pain because when you change your text, you have to manually cut and paste to justify each and every columns by trial-n-error....
62
3858
by: Xah Lee | last post by:
Criticism versus Constructive Criticism Xah Lee, 2003-01 A lot intelligent people are rather confused about criticism, especially in our “free-speech” free-for-all internet age. When they say “constructive criticisms are welcome” they mostly mean “bitching and complaints not welcome”. Rarely do people actually mean that...
12
3573
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet utilities that allows you to view them with live rotation in a web browser. Also, it includes a introductory tutorial to POV-Ray.
0
7578
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
8010
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7530
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5414
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3539
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1994
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1111
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.