Michiel Helvensteijn wrote:
Leandro Lucarella wrote:A more general solution is supporting tuples in the language, then you can do something like: a, b = b, a;That's a great feature. But even if it's available, I'd use swap, because: * I wouldn't have to mention each variable twice * It would use move-operations rather than copy operations Parallel assignment is still useful for other stuff, like traversing the fibonachi sequence with two variables :-) (a, b) <- (b, a + b);
Or when you need to reorder more than two variables: a, b, c, d = b, d, a, c; Jerome -- mailto:jeber...@free.fr http://jeberger.free.fr Jabber: jeber...@jabber.fr
signature.asc
Description: OpenPGP digital signature