Re: First language with conditional assignment?

Andy Walker <news@cuboid.co.uk>
Sat, 05 Mar 2011 14:36:28 +0000

          From comp.compilers

Related articles
First language with conditional assignment? compilers@is-not-my.name (2011-03-03)
Re: First language with conditional assignment? nmh@t3x.org (Nils M Holm) (2011-03-04)
Re: First language with conditional assignment? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-03-04)
Re: First language with conditional assignment? cr88192@hotmail.com (BGB) (2011-03-04)
Re: First language with conditional assignment? kym@kymhorsell.com (2011-03-05)
Re: First language with conditional assignment? robin51@dodo.com.au (robin) (2011-03-05)
Re: First language with conditional assignment? news@cuboid.co.uk (Andy Walker) (2011-03-05)
Re: First language with conditional assignment? monnier@iro.umontreal.ca (Stefan Monnier) (2011-03-05)
Re: First language with conditional assignment? derekrss@yahoo.ca (Derek) (2011-03-06)
Re: First language with conditional assignment? compilers@is-not-my.name (2011-03-07)
Re: First language with conditional assignment? compilers@is-not-my.name (2011-03-07)
Re: First language with conditional assignment? compilers@is-not-my.name (2011-03-07)
Re: First language with conditional assignment? neitzel@gaertner.de (2011-03-07)
[5 later articles]
| List of all articles for this month |

From: Andy Walker <news@cuboid.co.uk>
Newsgroups: comp.compilers
Date: Sat, 05 Mar 2011 14:36:28 +0000
Organization: Compilers Central
References: 11-03-006 11-03-009
Keywords: syntax, history
Posted-Date: 05 Mar 2011 10:39:29 EST

On 04/03/11 20:50, glen herrmannsfeldt wrote:
> ALGOL, I believe ALGOL 60 (I don't know the versions very well)
> has the "conditional arithmetic expression" as:
> A := IF I<0 THEN R ELSE 3;
> That is the example from Baumann, et. al, "Introduction
> to ALGOL" from 1964, I believe describing ALGOL 60.
> I don't know when it originated in ALGOL.


That is indeed in Algol 60; there is no trace of any such
animal in "Algol 58" [IAL]. Note that because there is no closing
bracket, you often need extra parentheses in a more complicated
situation.


By Algol 68, the construction has gone the whole hog, and
you can use "if ... fi" on the LHS of an assignment:


if x < y then x else y fi := 1;


or to select functions [but, sadly, not operators]:


z := if x < y then sin else cos fi (pi/5);


etc., etc. Note that "( ... | ... | ... )" can always be used in
place of "if ... then ... else ... fi" and is usually the more
appealing syntax when the "..." are simple; in general, the "..."
can be replaced by an arbitrarily complicated serial clause, even
within arithmetic expressions.


--
Andy Walker,
Nottingham.



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.