I am having an issue with a macro that I am not managing to solve.

The code is messy, but I will try to make clear the issue.

I have the source code 
[here](https://github.com/mantielero/ipopt.nim/tree/master/src). When I compile 
this code, the last lines displayed (from expandMacro):
    
    
    echo [repr [[2.0 * x[3]], [x[3], 0.0], [x[3], 0.0, 0.0],
              [2.0 * x[0] + x[1] + x[2], x[0], x[0], 0.0]]]

created by [this 
lines](https://github.com/mantielero/ipopt.nim/blob/9967dc72130a45e8d6a675439f174cf24a01c941/src/ipopt.nim#L474).

Basically, obj_hess is typed as seq[seq[NimNode]] and contains a triangular 
matrix:
    
    
    [ [2.0 * x[3]],
      [x[3],                         0.0],
      [x[3],                         0.0,       0.0],
      [2.0 * x[0] + x[1] + x[2],     x[0],      x[0],       0.0]]]

The problem is when I reference a particular line or item. If I do the 
following in line 474:
    
    
    echo repr `obj_hess`[0]

I get the following error:
    
    
    /home/jose/src/ipopt.nim/src/ipopt.nim(547, 3) template/generic 
instantiation of `problem` from here
    /home/jose/src/ipopt.nim/src/ipopt.nim(323, 15) Error: type mismatch: got 
<array[0..1, Number]> but expected 'array[0..0, float]'

Reply via email to