🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #620

Re: swap(x,y) in Algol 60

#620
From: SEZ
Date: Fri, 08 Sep 1989 12:54
32 lines
1872 bytes
In response to this note:
>/* ---------- "swap(x,y) in Algol 60" ---------- */
>I have seen a folk theorem that it is impossible to define swap(x,y) in
>Algol, where swap is supposed to be a procedure with two call-by-name integer
>arguments which exchanges their values.  It's not exactly clear what the
>statement of the theorem should be when (say) x and y have side effects.
>
>I've asked around MIT and some at Cornell, and nobody seems to have a
>reference to the statement or proof.  Anyone remember where this came from?
>
>Thanks,
>  Bard Bloom

The easiest example is:

     swap(a[i], i);

The issue is that Algol's call-by-name mechanism would require that
if you change the value of "i" then you are referencing a different
element of the array "a".

Stan Zaborowski
------------------------------------------------------------------------
|  The above opinions are mine, mine alone, and no one else's but mine.|
|No clear thinking, Right-Wing, Libertarian would ever hold the same   |
|opinions as anyone else; unless, of course, you would like to make it |
|worth my while . . .                                                  |
------------------------------------------------------------------------
| I am the NRA.   That should make      |         This space           |
| you feel better.                      |         for rent             |
------------------------------------------------------------------------
Technical Details
Message-ID: <126800002@S67.Prime.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!primerd!ENI!S67!SEZ
References: <31690@cornell.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!primerd!ENI!S67!SEZ
From: SEZ@S67.Prime.COM
Newsgroups: comp.lang.misc
Subject: Re: swap(x,y) in Algol 60
Message-ID: <126800002@S67.Prime.COM>
Date: 8 Sep 89 12:54:00 GMT
References: <31690@cornell.UUCP>
Lines: 32
Nf-ID: #R:cornell.UUCP:-3169000:S67:126800002:000:1439
Nf-From: S67.Prime.COM!SEZ    Sep  8 12:54:00 1989