Tuple assignment
Russel Winder via Digitalmars-d
digitalmars-d at puremagic.com
Sat May 9 10:16:43 PDT 2015
Python has tuple assignment so you see things like:
previous, current = current, previous + current
especially if you are doing silly things like calculating Fibonacci
Sequence values. Translating this to D, you end up with:
TypeTuple!(current, next) = tuple(next , current +next);
I am assuming this is horrendously inefficient at run time compared to
having the intermediate value explicit:
auto t = next;
next = current + next;
current = t;
or is it?
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150509/0bf711c5/attachment.sig>
More information about the Digitalmars-d
mailing list