A little puzzle

bearophile bearophileHUGS at lycos.com
Mon Sep 19 14:20:47 PDT 2011


A tiny puzzle I've shown on IRC. This is supposed to create an inverted array of cards, but what does it print instead?

import std.stdio, std.algorithm, std.range;
void main() {
    int[52] cards;
    copy(iota(cards.length - 1, -1, -1), cards[]);
    writeln(cards);
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list