I tried to create a template that expands to multiple values during sequence 
initialization, eg:
    
    
    template myTemplate(x: untyped) =
      int(x), int(x shr 2)
    
    var a: seq[int] = @[myTemplate(13)]
    assert(a == @[13, 3])
    
    
    Run

The compiler complains, that it expected an expression, but instead found the 
`,`. In comparison, this is easily done in C:
    
    
    #define MYTEMPLATE(x) (int)(x), (int)((x)>>2)
    
    int a[2] = { MYTEMPLATE(13) }
    
    
    Run

Is there a way to create the same in Nim?

Reply via email to