Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tcl 8.4 vs 8.5

86 views
Skip to first unread message

Why Tea

unread,
Feb 5, 2012, 4:16:43 PM2/5/12
to
This is OK in 8.5:
expect1.3> set a {1 2 3}
1 2 3
expect1.4> expr {[lindex $a 1] in {2 3 4}}
1

But not OK in 8.4:
expect1.8> set a {1 2 3}
1 2 3
expect1.10> expr {[lindex $a 1] in {2 3 4}}
syntax error in expression "[lindex $a 1] in {2 3 4}": extra tokens at end of expression
while compiling
"expr {[lindex $a 1] in {2 3 4}}"

Is there a way to make the expression backward compatible in 8.4?

/WT

Alexandre Ferrieux

unread,
Feb 5, 2012, 6:50:05 PM2/5/12
to
Though the error message was not that clear (expr error reporting has
improved since then), the truth is just that "in" was not there yet :D
An equivalent working in older Tcls:

expr {[lsearch -exact {2 3 4} [lindex $a 1]]>=0}

-Alex

Why Tea

unread,
Feb 6, 2012, 4:07:55 AM2/6/12
to
Thanks Alex.

/WT
0 new messages