前缀,中缀,后缀和全功能表示法的概念和混淆 [英] The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations

查看:72
本文介绍了前缀,中缀,后缀和全功能表示法的概念和混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前缀,中缀,后缀和完全的概念和混淆

功能符号


Xah Lee,2006-03-15


[本文解释了用于计算机语言的

表示法系统的常见术语的混淆:前缀,中缀,后缀,

代数,功能。这些符号与

运营商的概念有关。这些是使用LISP,Mathematica,

和命令式语言的例子来解释的。然后,它讨论了纯粹

嵌套表示法的一些问题。]

在LISP语言中,它们使用的符号类似于??(+ 1 2)a ??意思是一个?? 1 + 2a ??。

同样,他们写一个??(如果测试这个)a ??表示?? ?? if(test){this}

else {that} a ?? LISP代码都是a ??(a b c ...)a ??的形式,其中

a b c本身也可以是那种形式。有一个广泛的

误解,这种表示法是一个前缀notationa ?? ..在这篇

文章中,我将给出一些概述代数

符号和前缀,中缀,后缀符号,并解释LISP

符号是一种功能符号而不是所谓的前缀

符号或代数符号。


我们在学校遇到的数学符号,如?? 1 + 2a ??,被称为

Infix代数符号。代数符号具有

运算符的概念,意思是围绕参数放置的符号。在代数

中缀表示法中,不同的符号具有不同的粘性等级

为它们定义。例如一个π 3 + 2 * 5个图7a ??是指Δε(3+(2 * 5))> 7a ??。操作符号的粘性

通常称为??运算符Precedencea ??。它是通过给出符号的订单规范来完成的,或等价地,

给每个符号一个整数索引,这样例如如果我们有

a ?? aa ?? ba ?? ca ??,我们可以毫不含糊地理解它意味着一个??(aa ?? b)a ?? ca ??

或a ?? aa ??(ba ?? c)a ??。


在一个称为波兰表示法的代数后缀表示法中,需要

没有这个概念运算符优先级。例如,中缀

表示法a ??(3+(2 * 5))> 7a ??被写为?? 3 2 5 * + 7> a ??,其中

操作只是从左到右进行计算。同样,对于前缀

表示法语法,评估从右到左,如在?? 7+

* 5 2 3a ??中。


虽然功能符号,但不要使用运算符的概念,因为没有运算符,所以
。一切都是语法上的一个函数,写成f(a,b,c ......)。例如,上面相同的表达式

写成?? ??(+(3,*(2,5)),7)a ??或者a ?? greaterThan(加(3,

次(2,5)),7)a ??


尤其对于lisps,他们的全功能符号是

历史上称为sexp(S-Expression的缩写,其中S代表

符号)。它有时被称为完全括号表示法。对于

示例,在lisp中它将是(f a b c ...)。在上面的例子中它

是:a ??((+ 3(* 2 5))7)a ??


常见的概念一个??前缀,后缀,infixa ??是理想的

只有代数符号。因为在全功能表示法中,

不是运算符,因此无需谈论。函数'

参数只是在一对封闭的

分隔符中明确写出来。


另一种查看方式那个lisp符号不是?? prea ??什么,是通过

意识到a ?? heada ?? f in(f a b c)可以定义为

。例如(a b c f)或甚至(a f b c),其句法语法

保持不变。在Mathematica语言中,f(abc)将被写为f [a,b,c],其中参数封闭符号是方形

括号而不是括号,和参数分隔符是逗号

而不是空格,函数符号(又名a ?? heada ??)放在

外面和参数封装符号前面。


误认为lisp符号是??前缀的原因??是

因为a ?? heada ??在所附的

括号中显示为第一个元素。这样使用术语a ?? prefixa ??是一个混乱的生成者

,因为该术语的意义在于代数符号

涉及运算符概念的系统。


旁注:术语a ?? Algebraica ??符号用词不当。它b / b
似乎意味着这样的符号与数学的代数叫做代数,而其他符号系统则没有。

之所以使用名称代数符号是因为当

代数的科学很年轻时,大约1700年代数学家正在使用符号处理

方程式像一个?? + ?? ?? =一个??写出类似于我们今天使用它们的方式。这是在19世纪19世纪的19世纪19年代的计算机语言学习中,需要对符号系统进行系统调查的系统活动。所以,当符号实际上发明了b $ b系统时,传统的方式是加入一个?? + ??

= a ??被称为代数因为这是人们在看到它们时所想到的。


--------

这篇文章是一个由3部分组成的博览会的一部分:

a ??前缀,中缀,后缀和完全的概念和混淆

功能表示法??,

a ?? Mathematicaa中的前缀,中缀,后缀符号??,

a ??纯嵌套符号如何限制语言的实用性??,

可在以下网址获得:
http://xahlee.org/UnixResource_dir /writ/notations.html


Xah
xa*@xahlee.org

a ?? http://xahlee.org/

The Concepts and Confusions of Prefix, Infix, Postfix and Fully
Functional Notations

Xah Lee, 2006-03-15

[This articles explains away the confusion of common terms for
notation systems used in computer languages: prefix, infix, postfix,
algebraic, functional. These notation''s relation to the concept of
operators. These are explained using examples from LISP, Mathematica,
and imperative languages. Then, it discuss some problems of purely
nested notation.]

In LISP languages, they use a notation like a??(+ 1 2)a?? to mean a??1+2a??.
Likewise, they write a??(if test this that)a?? to mean a??if (test) {this}
else {that}a??. LISP codes are all of the form a??(a b c ...)a??, where the
a b c themselves may also be of that form. There is a wide
misunderstanding that this notation being a??prefix notationa??.. In this
article, i''ll give some general overview of the meanings of Algebraic
Notation and prefix, infix, postfix notations, and explain how LISP
notation is a Functional Notation and is not a so-called prefix
notation or algebraic notation.

The math notation we encounter in school, such as a??1+2a??, iscalled
Infix Algebraic Notation. Algebraic notations have the concept of
operators, meaning, symbols placed around arguments. In algebraic
infix notation, different symbols have different stickiness levels
defined for them. e.g. a??3+2*5>7a?? means a??(3+(2*5))>7a??. The stickiness
of operator symbols is normally called a??Operator Precedencea??. 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??aa??ba??ca??, we can unambiguously understand itto mean one of a??(aa??b)a??ca??
or a??aa??(ba??c)a??.

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

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

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: a??((+ 3 (* 2 5)) 7)a??.

The common concepts of a??prefix, postfix, infixa?? are notionsin
algebraic notations only. Because in Full Functional Notation, there
are no operators, therefore no positioning to talk about. A Function''s
arguments are simply explicitly written out inside a pair of enclosing
delimiters.

Another way to see that lisp notation are not a??prea?? anything, is by
realizing that the a??heada?? 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 its syntax syntactical
remains the same. 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 (aka a??heada??) is placed in
outside and in front of the argument enclosure symbols.

The reason for the misconception that lisp notations are a??prefixa?? is
because the a??heada?? appears as the first element in the enclosed
parenthesis. Such use of the term a??prefixa?? is a confusion engenderer
because the significance of the term lies in algebraic notation
systems that involves the concept of operators.

A side note: the terminology a??Algebraica?? 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 a??+ ?? =a?? written out similar to the way we
use them today. This is before the activities of systematic
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 a??+ ??
=a?? became known as algebraic because that''s what people think of when
seeing them.

--------
This post is part of a 3-part exposition:
a??The Concepts and Confusions of Prefix, Infix, Postfix and Fully
Functional Notationsa??,
a??Prefix, Infix, Postfix notations in Mathematicaa??,
a??How Purely Nested Notation Limits The Language''s Utilitya??,
available at:
http://xahlee.org/UnixResource_dir/writ/notations.html

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

推荐答案

[" Followup-To:"标题设置为comp.lang.lisp。]


2007-05-23,Xah Lee< xa*@xahlee.orgwrote:
["Followup-To:" header set to comp.lang.lisp.]

On 2007-05-23, Xah Lee <xa*@xahlee.orgwrote:

前缀,中缀,后缀和完全概念和混淆

功能符号


Xah Lee,2006-03-15
The Concepts and Confusions of Prefix, Infix, Postfix and Fully
Functional Notations

Xah Lee, 2006-03-15



Xah,你为什么要把一年之久的论文发布到那些无关紧要的新闻组上?

Xah, why do you post year-old essays to newsgroups that couldn''t care
less about them?



2007-05-23,Xah Lee< xa*@xahlee.orgwrote:
On 2007-05-23, Xah Lee <xa*@xahlee.orgwrote:

>前缀,中缀,后缀和完全功能符号的概念和混淆

Xah Lee,2006-03-15
>The Concepts and Confusions of Prefix, Infix, Postfix and Fully
Functional Notations

Xah Lee, 2006-03-15



Xah,你为什么要把一年之久的论文发给那些无所谓的新闻组?b
少关于他们?


Xah, why do you post year-old essays to newsgroups that couldn''t care
less about them?



更重要的是 - 为什么他现在再次发布他在2007年5月9日发布的相同的

传输量?我们现在是否会每两周对他们的垃圾进行重复处理?


您的问题的答案很简单:Xah Lee是一个巨魔。<问候 - Markus


And even more to the point -- why does he post now again the same
drivel he already posted on the 9th of May 2007? And will we now
treated to repeats of his garbage every 2 weeks?

The answer to your question is very simple: Xah Lee is a troll.

Regards -- Markus


Markus E Leypold写道:
Markus E Leypold wrote:

你的问题的答案非常简单:Xah Lee是一个巨魔。
The answer to your question is very simple: Xah Lee is a troll.



在这种情况下,我相信他正在营销/宣传自己是一名

顾问和某种吸血鬼男人妓女页面:

http://xahlee.org/ PageTwo_dir / Personal_dir / xah.html


" ...我在技术上是美国人。爱我,我可以让你成为美国人。


Xah也许是世界上第一个声称自己是Lisp

程序员的人坚强的人。 :-)


无论如何,是否有任何库可以使用Perl,Python,Lisp,Java或任何函数语言(OCaml除外)进行硬件加速矢量图形处理
和F#

并且不包括WPF和Silverlight)?


-

Jon D Harrop博士,Flying Frog Consultancy
F#.NET期刊
http:/ /www.ffconsultancy.com/product...rp_journal/?u7

In this context, I believe he is marketing/advertising himself as a
consultant and some kind of vampiric man-whore according to this page:

http://xahlee.org/PageTwo_dir/Personal_dir/xah.html

"... I''m technically American. Love me and I can make you American."

Xah is perhaps the world''s first person to claim to be both a Lisp
programmer and "strong at siring". :-)

Anyway, are there any libraries to do hardware accelerated vector graphics
in Perl, Python, Lisp, Java or any functional language (except OCaml and F#
and excluding WPF and Silverlight)?

--
Dr Jon D Harrop, Flying Frog Consultancy
The F#.NET Journal
http://www.ffconsultancy.com/product...rp_journal/?u7


这篇关于前缀,中缀,后缀和全功能表示法的概念和混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆