How to get TCL list index element using a variable?
<p>I have a TCL list </p>

<pre><code>   set d_nets { reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7} 
</code></pre>

<p>I want certain manipulation and get an element. 
Example -</p>

<pre><code>  for {set i 0} {$i &lt; 128} {incr i} {
      set new_indx [expr { 7 - $i }]   #expression can be more complicated
      lindex $d_nets $new_indx 
  }
</code></pre>

<p>However this flags an error </p>

<blockquote>
  <p>Error: bad index "....": must be integer?[+-]integer? or end?[+-]integer?</p>
</blockquote>

<p>Any help with lindex usage here? </p>