Article View: net.lang.apl
Article #134Programming idiom
From: Dave Blickstein
Date: Sun, 17 Feb 1985 19:10
Date: Sun, 17 Feb 1985 19:10
16 lines
1090 bytes
1090 bytes
Gee, I think any dedicated idiom freak would never use the example you gave to
exchange two values. A much more "idiomatic" idiom for exchanging two
values A and B is
A = A XOR B;
B = B XOR A; /* If you don't think this works
A = A XOR B; write out a truth table */
Note that this version has the additional advantage of not requiring
a temporary.
Dave Blickstein
(UUCP) {allegra|decvax|ihnp4|ucbvax}!decwrl!dec-rhea!dec-orphan!blickstein
(ARPA) BLICKSTEIN%ORPHAN.DEC@DECWRL.ARPA
Technical Details
Message-ID:
<607@decwrl.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!zehntel!dual!decwrl!dec-rhea!dec-speedy!blicksteinShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decwrl.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!zehntel!dual!decwrl!dec-rhea!dec-speedy!blickstein From: blickstein@speedy.DEC (Dave Blickstein) Newsgroups: net.lang.apl Subject: Programming idiom Message-ID: <607@decwrl.UUCP> Date: Sun, 17-Feb-85 14:10:00 EST Article-I.D.: decwrl.607 Posted: Sun Feb 17 14:10:00 1985 Date-Received: Tue, 19-Feb-85 06:53:47 EST Sender: daemon@decwrl.UUCP Organization: DEC Engineering Network Lines: 16