D with experimental features like tuple unpacking

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Mar 22 01:15:12 PDT 2013


22-Mar-2013 11:05, Denis Shelomovskij пишет:
> 22.03.2013 1:13, bearophile пишет:
>> And in foreach:
>>
>> foreach ((c, ref e); loa)
>
>
> D already have undocumented[1] front tuple expansion in foreach over range:
> ---
> import std.algorithm;
> import std.stdio;
>
> void main() {
>      enum s = "this is an example for huffman encoding"d;
>      foreach (c, n; s.dup.sort().release().group())
>          writefln("'%s'  %s", c, n);
> }
> ---
>
> [1] http://d.puremagic.com/issues/show_bug.cgi?id=7361
>

Nice, but where is the freaking manual :)

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list