For Programmers: Free Programming Magazines  


Home > Archive > Functional > June 2007 > The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2007-05-23, 7:07 pm

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 =E2=80=9C(+ 1 2)=E2=80=9D to me=
an =E2=80=9C1+2=E2=80=9D.
Likewise, they write =E2=80=9C(if test this that)=E2=80=9D to mean =E2=80=
=9Cif (test) {this}
else {that}=E2=80=9D. LISP codes are all of the form =E2=80=9C(a b c ...)=
=E2=80=9D, where the
a b c themselves may also be of that form. There is a wide
misunderstanding that this notation being =E2=80=9Cprefix notation=E2=80=9D=
.. 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 =E2=80=9C1+2=E2=80=9D, is=
called
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. =E2=80=9C3+2*5>7=E2=80=9D means =E2=80=9C(3+(2*5))>7=
=E2=80=9D. The stickiness
of operator symbols is normally called =E2=80=9COperator Precedence=E2=80=
=9D. 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
=E2=80=9Ca=E2=8A=97b=E2=8A=99c=E2=80=9D,
we can unambiguously understand it=
to mean one of =E2=80=9C(a=E2=8A=97b)=E2=8A=99c=E2=80=9
D
or =E2=80=9Ca=E2=8A=97(b=E2=8A=99c)=E2=80=9
D.

In a algebraic postfix notation known as Polish Notation, there needs
not to have the concept of Operator Precedence. For example, the infix
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
operation simply evaluates from left to right. Similarly, for a prefix
notation syntax, the evaluation goes from right to left, as in =E2=80=9C> 7=
+
* 5 2 3=E2=80=9D.

While functional notations, do not employ the concept of Operators,
because there is no operators. Everything is a syntactically a
=E2=80=9Cfunction=E2=80=9D, written as f(a,b,c...). For example, the same e=
xpression
above is written as =E2=80=9C>( +(3, *(2,5)), 7)=E2=80=9D or =E2=80=9Cgreat=
erThan( plus(3,
times(2,5)), 7)=E2=80=9D.

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: =E2=80=9C(> (+ 3 (* 2 5)) 7)=E2=80=9D.

The common concepts of =E2=80=9Cprefix, postfix, infix=E2=80=9D are notions=
in
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 =E2=80=9Cpre=E2=80=9D anythin=
g, is by
realizing that the =E2=80=9Chead=E2=80=9D 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 =E2=80=9Chead=E2=80=9D) is p=
laced in
outside and in front of the argument enclosure symbols.

The reason for the misconception that lisp notations are =E2=80=9Cprefix=E2=
=80=9D is
because the =E2=80=9Chead=E2=80=9D appears as the first element in the encl=
osed
parenthesis. Such use of the term =E2=80=9Cprefix=E2=80=9D is a confusion e=
ngenderer
because the significance of the term lies in algebraic notation
systems that involves the concept of operators.

A side note: the terminology =E2=80=9CAlgebraic=E2=80=9D Notation is a misn=
omer. 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 =E2=80=9C+ =C3=97 =3D=E2=80=9D written out sim=
ilar 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 =E2=80=9C+ =
=C3=97
=3D=E2=80=9D became known as algebraic because that's what people think of =
when
seeing them.

--------
This post is part of a 3-part exposition:
=E2=80=9CThe Concepts and Confusions of Prefix, Infix, postfix and Fully
Functional Notations=E2=80=9D,
=E2=80=9CPrefix, Infix, postfix notations in Mathematica=E2=80=9D,
=E2=80=9CHow Purely Nested Notation Limits The Language's Utility=E2=80=9D,
available at:
http://xahlee.org/UnixResource_dir/writ/notations.html

Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/

Larry Clapp

2007-05-23, 7:07 pm

["Followup-To:" header set to comp.lang.lisp.]

On 2007-05-23, Xah Lee <xah@xahlee.org> wrote:
> The Concepts and Confusions of Prefix, Infix, postfix and Fully
> Functional Notations
>
> Xah Lee, 2006-03-15


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

Jon Harrop

2007-05-29, 4:17 am

Markus E Leypold wrote:
> The answer to your question is very simple: Xah Lee is a troll.


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/produc...arp_journal/?u7
Ulf Wiger

2007-05-29, 8:04 am

>>>>> "Jon" == Jon Harrop <jon@ffconsultancy.com> writes:

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

I guess the OpenGL binding for Erlang qualifies. The best
exhibit of this would be Wings3D, an Open Source 3D
graphics modeller, written in Erlang, and with quite a
large user base.

http://www.wings3d.com

BR,
Ulf W

--
Ulf Wiger, Senior Specialist,
/ / / Architecture & Design of Carrier-Class Software
/ / / Team Leader, Software Characteristics
/ / / Ericsson AB, IMS Gateways
Mark T.B. Carroll

2007-05-29, 8:04 am

Jon Harrop <jon@ffconsultancy.com> writes:
(snip)
> 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)?

(snip)

(to comp.lang.functional only) We've been using HOpenGL (w/ GLUT) for
Haskell with some success. See http://www.haskell.org/HOpenGL/

-- Mark
Xah Lee

2007-05-30, 4:07 am

Prefix, Infix, postfix notations in Mathematica

2000-02-21, 2007-05

[In the following essay, I discuss prefix, infix, postfix notations
and Mathematica's syntax for them. The full HTML formatted article is
available at:
http://xahlee.org/UnixResource_dir/writ/notations.html
]

THE HEAD OF EXPRESSIONS

Lisp's nested parenthesis syntax is a Functional Notation. It has the
general form of =E2=80=9C(f a b ...)=E2=80=9D where any of the symbols insi=
de the
matching parenthesis may again be that form. For example, here's a
typical code from Emacs Lisp.

; Recursively apply (f x i), where i is the ith element in the list
li.
; For example, (fold f x '(1 2)) computes (f (f x 1) 2)
(defun fold (f x li)
(let ((li2 li) (ele) (x2 x))
(while (setq ele (pop li2))
(setq x2 (funcall f x2 ele))
)
x2
)
)

Vast majority of computer languages, interpret source code in a one-
dimensional, linear nature. Namely, from left to right, line by line,
as in written text. (Examples of computer languages's source code that
are not linear in nature, are spread sheets, cellular automata,
graphical programing languages) For languages that interprets source
code linearly, the logics of their syntax necessarily have a
hierarchical structure (i.e. tree). The lisp's notation, is the most
effective in visually showing the logics of the syntax. This is
because, a function and its arguments, are simply laid out inside a
parenthesis. The level of nesting corresponds to the =E2=80=9Cprecedence=E2=
=80=9D in
evaluating the expression.

The first element inside the matching parenthesis, is called the
=E2=80=9Chead=E2=80=9D of the expression. For example, in =E2=80=9C(f a b)=
=E2=80=9D, the =E2=80=9Cf=E2=80=9D is the
head. The head is a function, and the rest of the symbols inside the
matching parenthesis are its arguments.

The head of lisp's notation needs not to be defined as the first
element inside the parenthesis. For example, we can define the =E2=80=9Chea=
d=E2=80=9D
to be the last element inside the parenthesis. So, we write =E2=80=9C(arg1
arg2 ... f)=E2=80=9D instead of the usual =E2=80=9C(f arg1 arg2 ...)=E2=80=
=9D and its
syntactical analysis remains unchanged. Like wise, you can move the
head outside of the parenthesis.

In Mathematica, the head is placed in front of the parenthesis, and
square brackets are used instead of parenthesis for the enclosing
delimiter. For example, lisp's =E2=80=9C(f a b c)=E2=80=9D is syntactically=
equivalent
to Mathematica's =E2=80=9Cf[a,b,c]=E2=80=9D. Other examples: =E2=80=9C(sin =
=CE=B8)=E2=80=9D vs =E2=80=9CSin[=CE=B8]=E2=80=9D,
=E2=80=9C(map f list)=E2=80=9D vs =E2=80=9CMap[f,list]=E2=80=9D. Placing th=
e head in front of the
matching bracket makes the notation more familiar, because it is a
conventional math notation.

However, there is a divantage in moving the head of a expression
from inside the matching bracket to outside. Namely: The nesting of
the matching delimiters, no longer corresponds to the logics of the
syntax, when the head is itself a compound expression.

For example, suppose Reflection(vectorV,pointP) is function that
returns a function f, such that f(graphicsData) will reflect the
graphicsData along a line passing pointP and parallel to vectorV. In
lisp, we would write =E2=80=9C((Reflection vectorV pointP) graphicsData)=E2=
=80=9D. In
Mathematica, we would write =E2=80=9CReflection[vectorV,pointP]
[graphicsData]=E2=80=9D. In lisp's version, the nesting corresponds to the
logics of the evaluation. In the Mathematica's form, that is no longer
so.

For another example, suppose Deriv is a function that takes a function
f and returns a function g (the derivative of f), and we want to apply
g to a variable x. In lisp, we would write =E2=80=9C((Deriv f) x)=E2=80=9D.=
In
Mathematica, we would write =E2=80=9CDeriv[f][x]=E2=80=9D. In lisp's versio=
n, the
nesting corresponds to the logics of the evaluation. In the
Mathematica's form, the logics of the evaluation no longer corresponds
to the nesting level, because now the head is outside of the enclosing
delimiters, so the head of expressions no longer nests.

PREFIX, POSTFIX, INFIX

A prefix notation in Mathematica is represented as =E2=80=9Cf@arg=E2=80=9D.
Essentially, a prefix notation in this context limits it to uses for
functions on only one argument. For example: =E2=80=9Cf@a@b@c=E2=80=9D is e=
quivalent
to =E2=80=9Cf[a[b[c]]]=E2=80=9D or in lispy =E2=80=9C(f (a (b c)))=E2=80=9D=
.. Mathematica also offers a
postfix notation using the operator =E2=80=9C//=E2=80=9D. For example, =E2=
=80=9Cc//b//a//f=E2=80=9D is
syntactically equivalent to =E2=80=9Cf[a[b[c]]]=E2=80=9D. (unix's pipe =E2=
=80=9C|=E2=80=9D syntax, is
a form of postfix notation. e.g. =E2=80=9Cc | b | a | f=E2=80=9D).

For example, =E2=80=9CSin[List[1,2,3]]=E2=80=9D can be written in postfix as
=E2=80=9CList[1,2,3]//Sin=E2=80=9D, or prefix =E2=80=9CSin@List[1,2,3]=E2=
=80=9D. (by the way, they are
semantically equivalent to =E2=80=9CMap[Sin, List[1,2,3]]=E2=80=9D in Mathe=
matica) For
infix notation, the function symbol is placed between its arguments.
In Mathematica, the generic form for infix notation is by sandwiching
the tilde symbol around the function name. e.g.
=E2=80=9CJoin[List[1,2],List[3,4]]=E2=80
=9D is syntactically equivalent to =
=E2=80=9CList[1,2]
~Join~ List[3,4]=E2=80=9D.

In Mathematica, there is quite a lot syntax variations beside the
above mentioned systematic constructs. For example, Plus[a,b,c] can be
written as =E2=80=9Ca+b+c=E2=80=9D, =E2=80=9CPlus[a+b,c]=E2=80=9D, =E2=80=
=9CPlus[Plus[a,b],c]=E2=80=9D, or =E2=80=9C(a
+b)~Plus~c=E2=80=9D. =E2=80=9CList[a,b,c]=E2=80=9D can be written as =E2=80=
=9C{a,b,c}=E2=80=9D, and
=E2=80=9CMap[f,List[a,b,c]]=E2=80=9D can be written as =E2=80=9Cf /@ {a,b,c=
}=E2=80=9D.

The gist being that certain functions are given a special syntactical
construct to emulate the irregular and inefficient but nevertheless
well-understood conventional notations. Also, it reduces the use of
deep nesting that is difficult to type and manage. For example, the
=E2=80=9CPlus=E2=80=9D function is given a operator =E2=80=9C+=E2=80=9D, so=
that Plus[3,4] can be
written with the more familiar =E2=80=9C3+4=E2=80=9D. The =E2=80=9CList=E2=
=80=9D function is given a
syntax construct of =E2=80=9C{}=E2=80=9D, so that, List[3,4] can be more ea=
sily
written as =E2=80=9C{3,4}=E2=80=9D. The boolean =E2=80=9CAnd=E2=80=9D funct=
ion is given the operator
=E2=80=9C&&=E2=80=9D, so that And[a,b] can be written with the more familia=
r and
convenient =E2=80=9Ca && b=E2=80=9D. Combining all these types of syntax va=
riations,
it can make the source code easier to read than a purely nested
structure. For example, common math expressions such as =E2=80=9C3+2*5>7=E2=
=80=9D
don't have to be written as =E2=80=9CGreater[Plus[3,Times[2,5]],7]=E
2=80=9D=
or the
lispy =E2=80=9C(> (+ 3 (* 2 5)) 7)=E2=80=9D.
C and Perl

When we say that C is a infix notation language, the term =E2=80=9Cinfix
notation=E2=80=9D is used loosely for convenience of description. C and oth=
er
language's syntaxes derived from it (e.g. C++, Java, Perl,
Javascript...) are not based on a notation system, but takes the
approach of a ad hoc syntax soup. Things like =E2=80=9Ci++=E2=80=9D, =E2=80=
=9C++i=E2=80=9D, =E2=80=9Cfor(;;)
{}=E2=80=9D, =E2=80=9Cwhile(){}=E2=80=9D, 0x123, =E2=80=9Csprint(...%s...,.=
..=2E)=E2=80=9D, ... are syntax
whimsies.

As a side note, the Perl mongers are proud of their slogan of =E2=80=9CThere
Are More Than One Way To Do It=E2=80=9D 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 more syntax variations than the ad hoc
inflexible Perl both in theory AND in practice. (in lisp, its power of
syntax variation comes in the guise of macros.) And, more importantly,
Perlers clamor about Perl's =E2=80=9Cexpressiveness=E2=80=9D more or less o=
n the
syntax level but don't realize that semantic expressibility is far
more important.

Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/

xahlee@gmail.com

2007-06-08, 7:10 pm

How Purely Nested Notation Limits The Language's Utility

[The full HTML formatted article is available at:
http://xahlee.org/UnixResource_dir/writ/notations.html
]

2007-05-03

There is a common complain by programers about lisp's notation, of
nested parenthesis, being unnatural or difficult to read. Long time
lisp programers, often counter, that it is a matter of conditioning,
and or blaming the use of =E2=80=9Cinferior=E2=80=9D text editors that are =
not
designed to display nested notations. In the following, i describe how
lisp notation is actually a problem, in several levels.

(1) Some 99% of programers are not used to the nested parenthesis
syntax. This is a practical problem. On this aspect along, lisp's
syntax can be considered a problem.

(2) Arguably, the pure nested syntax is not natural for human to read.
Long time lispers may disagree on this point.

(3) Most importantly, a pure nested syntax discourages frequent or
advanced use of function sequencing or compositions. This aspect is
the most devastating.

The first issue, that most programers are not comfortable with nested
notation, is well known. It is not a technical issue. Whether it is
considered a problem of the lisp language is a matter of philosophical
disposition.

The second issue, about nested parenthesis not being natural for human
to read, may be debatable. I do think, that deep nesting is a problem
to the programer. Here's a example of 2 blocks of code that are
syntactically equivalent in the Mathematica language:

vectorAngle[{a1_, a2_}] :=3D Module[{x, y},
{x, y} =3D {a1, a2}/Sqrt[a1^2 + a2^2] // N;
If[x =3D=3D 0, If[Sign@y =3D=3D=3D 1, =CF=80/2, -=CF=80/2],
If[y =3D=3D 0, If[Sign@x =3D=3D=3D 1, 0, =CF=80],
If[Sign@y =3D=3D=3D 1, ArcCos@x, 2 =CF=80 - ArcCos@x]
]
]
]

SetDelayed[vectorAngle[List[Pattern[a1,B
lank[]],Pattern[a2,Blank[]]]],
Module[List[x,y],
CompoundExpression[
Set[List[x,y],
N[Times[List[a1,a2],
Power[Sqrt[Plus[Power[a1,2],Power[a2,2]]
],-1]]]],
If[Equal[x,0],
If[SameQ[Sign[y],1],Times[=CF=80,Power[2
,-1]],
Times[Times[-1,=CF=80],Power[2,-1]]],
If[Equal[y,0],If[SameQ[Sign[x],1],0,=CF=
80],
If[SameQ[Sign[y],1],ArcCos[x],
Plus[Times[2,=CF=80],Times[-1,ArcCos[x]]]]]]]]]


In the latter, it uses a full nested form (called FullForm in
Mathematica). This form is isomorphic to lisp's nested parenthesis
syntax, token for token (i.e. lisp's =E2=80=9C(f a b)=E2=80=9D is Mathemati=
ca's
=E2=80=9Cf[a,b]=E2=80=9D). As you can see, this form, by the sheer number o=
f nested
brackets, is in practice problematic to read and type. In Mathematica,
nobody really program using this syntax. (The FullForm syntax is
there, for the same reason of language design principle shared with
lisp of =E2=80=9Cconsistency and simplicity=E2=80=9D, or the commonly toute=
d lisp
advantage of =E2=80=9Cdata is program; program is data=E2=80=9D.)

The third issue, about how nested syntax seriously discourages
frequent or advanced use of inline function sequencing on the fly, is
the most important and I'll give further explanation below.

One practical way to see how this is so, is by considering unix's
shell syntax. You all know, how convenient and powerful is the unix's
pipes. Here are some practical example: =E2=80=9Cls -al | grep xyz=E2=80=9D=
, or =E2=80=9Ccat a
b c | grep xyz | sort | uniq=E2=80=9D.

Now suppose, we get rid of the unix's pipe notation, instead, replace
it with a pure functional notation: e.g. (uniq (sort (grep xyz (cat a
b c)))), or enrich it with a composition function and a pure function
construct (=CE=BB), so this example can be written as: ((composition uniq
sort (lambda (x) (grep xyz x))) (cat a b c)).

You see, how this change, although syntactically equivalent to the
pipe =E2=80=9C|=E2=80=9D (or semantically equivalent in the example using f=
unction
compositions), but due to the cumbersome nested syntax, will force a
change in the nature of the language by the code programer produces.
Namely, the frequency of inline sequencing of functions on the fly
will probably be reduced, instead, there will be more code that define
functions with temp variables and apply it just once as with
traditional languages.

A language's syntax or notation system, has major impact on what kind
of code or style or thinking pattern on the language's users. This is
a well-known fact for those acquainted with the history of math
notations.

The sequential notation =E2=80=9Cf@g@h@x=E2=80=9D, or =E2=80=9Cx//h//g//f=
=E2=80=9D, or unixy =E2=80=9Cx|h|g|
f=E2=80=9D, are far more convenient and easier to decipher, than =E2=80=9C(=
f (g (h
x)))=E2=80=9D or =E2=80=9C((composition f g h) x)=E2=80=9D. In actual code,=
any of the f, g, h
might be a complex pure function (aka lambda constructs, full of
parenthesis themselves).

Lisp, by sticking with a almost uniform nested parenthesis notation,
it immediately reduces the pattern of sequencing functions, simply
because the syntax does not readily lend the programer to it as in the
unix's =E2=80=9Cx|h|g|f=E2=80=9D. For programers who are aware of the codin=
g pattern
of sequencing functions, now either need to think in terms of a
separate =E2=80=9Ccomposition=E2=80=9D construct, and or subject to the much
problematic typing and deciphering of nested parenthesis.

(Note: Lisp's sexp is actually not that pure. It has ad hoc syntax
equivalents such as the =E2=80=9Cquote=E2=80=9D construct =E2=80=9C '(a b c=
) =E2=80=9D, and also =E2=80=9C`=E2=80=9D,
=E2=80=9C#=E2=80=9D, =E2=80=9C,@=E2=80=9D constructs, precisely for the pur=
pose of reducing
parenthesis and increasing readability. Scheme's coming standard the
R6RS =E2=86=97, even proposes the introduction of [] and {} and few other
syntax sugars to break the uniformity of nested parenthesis for
legibility. Mathematica's FullForm, is actually a version of
unadulterated nested notation as can be.)

Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/

Jürgen Exner

2007-06-08, 7:10 pm

xahlee@gmail.com wrote:
[nothing relevant to Perl]

Oh no, it is back.
Did your ISP finally cancel your old account or why are you switching to a
new address?
Don't try to disguise yourself. Your 'contributions' can easily be
identified no matter what pseudonym you are using.

***PLONK AGAIN***

jue


Twisted

2007-06-09, 4:08 am

On Jun 8, 7:30 pm, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> xah...@gmail.com wrote:
>
> [nothing relevant to Perl]


Perl?? Perl is even less relevant to Java than the original post,
which admittedly has some connection to pretty much all programming
languages. (Perl, on the other hand, has no connection to any known
programming language. ;) In particular, Perl code looks more like line
noise than like code from any known programming language. ;))

Paul McGuire

2007-06-09, 10:10 pm

On Jun 9, 6:49 am, Lew <l...@noemail.lewscanon.com> wrote:
>
> Hmm - I know of APL and SNOBOL.
>
> --
> Lew


TECO editor commands. I don't have direct experience with TECO, but
I've heard that a common diversion was to type random characters on
the command line, and see what the editor would do.

-- Paul

BCB

2007-06-09, 10:10 pm


"Paul McGuire" <ptmcg@austin.rr.com> wrote in message
news:1181414625.121073.203940@g4g2000hsf.googlegroups.com...
> On Jun 9, 6:49 am, Lew <l...@noemail.lewscanon.com> wrote:
>
> TECO editor commands. I don't have direct experience with TECO, but
> I've heard that a common diversion was to type random characters on
> the command line, and see what the editor would do.
>
> -- Paul
>


J

http://www.jsoftware.com/


Twisted

2007-06-10, 4:13 am

On Jun 9, 8:21 pm, "BCB" <b...@undisclosedlocation.net> wrote:
> "Paul McGuire" <p...@austin.rr.com> wrote in message
>
> news:1181414625.121073.203940@g4g2000hsf.googlegroups.com...
>
>
>
>
>
>
> J
>
> http://www.jsoftware.com/


Oh come on! Toy languages (such as any set of editor commands) and
joke languages (ala Intercal) don't count, even if they are
technically Turing-complete. ;)

Nor does anything that was designed for the every-character-at-a-
premium punch-card era, particularly if it is, or rhymes with,
"COBOL".

Those have excuses, like it's a joke or it's a constrained
environment. Perl, unfortunately, has no such excuses. If there were
such a thing as "embedded Perl", I'd have to hesitate here, but since
there isn't...

Reilly

2007-06-10, 10:05 pm

On Jun 10, 3:11 pm, Larry Elmore <ljelm...@verizon.spammenot.net>
wrote:
> Twisted wrote:
>
>
>
>
>
>
>
> Neither APL nor Snobol nor J are toy or joke languages.


I'd like register my agreement. SNOBOL was a very sophisticated
language and way ahead of its time in many ways. While it's not
really used anymore, SNOBOL's legacy does live on in languages that
are in wide use.

APL and it's successors (including J & K) are neither toys nor extinct
relics. APL is still used in a variety of applications. The price of
the last airline ticket you bought was probably determined by a yield
management application written in APL. K was created in 1993 and Kx
systems has built an incredibly valuable company on top of it.

APL's terseness has more to do with the Iverson's notational goals
than economy with characters related to punchcards. In fact, the
dominant languages of the punchcard era (COBOL & FORTRAN) are both
pretty verbose.

Lastly, ITS Teco wasn't a joke or toy language either.. It was
psychotically terse and virtually impenetrable to later review. But
it wasn't a toy. When I learned to use EMACS, it was still
implemented in ITS Teco.


BCB

2007-06-10, 10:05 pm


<snip>

>
> Neither APL nor Snobol nor J are toy or joke languages


I wholeheartedly agree, and did not mean to imply as much in my original
post, in which my intent was to emphasize the fact that, until you learn the
language, a J program /does/ resemble line noise! :-)


Twisted

2007-06-10, 10:05 pm

On Jun 10, 8:50 pm, "BCB" <b...@undisclosedlocation.net> wrote:
> I wholeheartedly agree, and did not mean to imply as much in my original
> post, in which my intent was to emphasize the fact that, until you learn the
> language, a J program /does/ resemble line noise! :-)


Eh. This isn't right. The whole discussion was supposed to have died
after the original Perl joke, certainly after the subsequent exclusion
of joke and toy languages. I think I made it clear also that an
editor's command set, Turing-complete though it may be, constitutes a
toy language. Anyway I amend the original claim to cover joke
languages, toy languages, and any write-only languages that
mysteriously aren't considered to fall into either of the former two
categories. After all, you can't really take a language seriously if
it's either impossible to write unmaintainable code in it OR
impossible to write maintainable code in it. The one is necessarily
trivial, and the other unsuitable for anything serious, except as a
machine-compiled intermediate format or a mechanism for assuring job
security.

Twisted

2007-06-11, 8:05 am

On Jun 11, 2:42 am, Joachim Durchholz <j...@durchholz.org> wrote:
> It is possible to write maintainable Perl.


Interesting (spoken in the tone of someone hearing about a purported
sighting of Bigfoot, or maybe a UFO).

Still, extraordinary claims require extraordinary evidence. (And no, a
fuzzy picture of something that might be a giant serpent-like thing in
the loch, or equivalent, does not constitute "extraordinary
evidence".)

Tim Bradshaw

2007-06-11, 10:05 pm

On Jun 11, 8:02 am, Twisted <twisted...@gmail.com> wrote:
> On Jun 11, 2:42 am, Joachim Durchholz <j...@durchholz.org> wrote:
>
>
> Interesting (spoken in the tone of someone hearing about a purported
> sighting of Bigfoot, or maybe a UFO).
>


I think it's just obvious that this is the case. What would *stop*
you writing maintainable Perl?

Twisted

2007-06-11, 10:05 pm

On Jun 11, 5:36 pm, Tim Bradshaw <tfb+goo...@tfeb.org> wrote:
> I think it's just obvious that this is the case. What would *stop*
> you writing maintainable Perl?


For starters, the fact that there are about six zillion obscure
operators represented by punctuation marks, instead of a dozen or so.
More generally, the fact that it comes out looking like modem barf,
and modem barf is unmaintainable. ;)

Twisted

2007-06-11, 10:05 pm

On Jun 11, 8:57 pm, Patricia Shanahan <p...@acm.org> wrote:
> I wrote a Perl script to process logic analyzer traces for some hardware
> engineers. While I was out of the office, they found they needed to
> process a new record type. They didn't want to delay their work until I
> got back, and one of the EEs knew Perl, so he modified my script.
>
> The change was done correctly. It not only worked. Except for a couple
> of comments calling my attention to the changes, it looked as though
> the new record type had always been there.


*blinks*

Hallelujah! It's a miracle! Praise be the Lord! This must surely be a
sign...

a sign of the End Times. :P

Thomas F. Burdick

2007-06-12, 7:06 pm

On Jun 11, 11:36 pm, Tim Bradshaw <tfb+goo...@tfeb.org> wrote:
> On Jun 11, 8:02 am, Twisted <twisted...@gmail.com> wrote:
>
>
>
>
> I think it's just obvious that this is the case. What would *stop*
> you writing maintainable Perl?


The constantly shifting target of a language. Hell, even the parser
has changed over time. Fortunately this seems to have been solved by
Perl 6 [*].

[*] Stopping work on Perl 5 to focus on the probably never-to-be Perl
6 brought a surprising stability to the language.

Peter J. Holzer

2007-06-16, 10:09 pm

["Followup-To:" header set to comp.lang.perl.misc.]
On 2007-06-12 08:15, Thomas F. Burdick <tburdick@gmail.com> wrote:
> On Jun 11, 11:36 pm, Tim Bradshaw <tfb+goo...@tfeb.org> wrote:
>
> The constantly shifting target of a language. Hell, even the parser
> has changed over time.


As with any other language I know, too (well, maybe cobol hasn't changed
in the last 10 years - I haven't looked lately).

The grammar of perl hasn't changed much since perl 5.0, which was
released in 1994. There were a few minor additions, but just about every
perl 5.0 script would still run with perl 5.8.x.

Try getting to run 13 year old C++ code with a current compiler some
time ...


> Fortunately this seems to have been solved by
> Perl 6 [*].
>
> [*] Stopping work on Perl 5 to focus on the probably never-to-be Perl
> 6 brought a surprising stability to the language.


Perl 6 started in 2000, AFAIR, when 5.005_03 was the stable release of
perl5 (with development on perl 5.6 well on the way, yes).
Maybe my memory is faulty but I don't have the impression that there was
much more change in the six years between 5.0 and and 5.005_03 than in the
seven years between 5.005 and 5.8.8 (despite everybody complaining that
perl (not Perl) is essentially unmaintable).

hp


--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Symin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com