Daily downloads in decline

Dennis Ritchie via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 11 10:48:51 PDT 2015


On Thursday, 11 June 2015 at 17:41:49 UTC, Andrei Alexandrescu 
wrote:
>> It is possible that Walter and Andrei against macro because of 
>> this:
>>
>> macro_rules! o_O {
>>      (
>>          $(
>>              $x:expr; [ $( $y:expr ),* ]
>>          );*
>>      ) => {
>>          &[ $($( $x + $y ),*),* ]
>>      }
>> }
>>
>> fn main() {
>>      let a: &[i32]
>>          = o_O!(10; [1, 2, 3];
>>                 20; [4, 5, 6]);
>>
>>      assert_eq!(a, [11, 12, 13, 24, 25, 26]);
>> }
>>
>> It looks disgusting! ;)
>
> Is that actual Rust code that compiles and runs? -- Andrei

Yes, this code is working. I took it here:
https://doc.rust-lang.org/stable/book/macros.html#repetition


More information about the Digitalmars-d mailing list