I just realized, that
lsearch -real -index 0 {0 1.0} 1.00
does not find the 1.0 element in the given list!
Same for:
lsearch -real -index 0 {0 1.0} 1
Why is that???
Since "expr 1.0==1.00" and "expr 1.0==1" return true, I realy wonder...
Any explanation for this behavior?
lsearch -real -index 0 {0 1.0} 1.00
does not find the 1.0 element in the given list!
Any explanation for this behavior?
On 17/09/2025 16:19, meshparts wrote:
lsearch -real -index 0 {0 1.0} 1.00[snip]>
does not find the 1.0 element in the given list!
Any explanation for this behavior?
The matching style for lsearch defaults to -glob. The -real option is
only meaningful when used with the -exact option. And then it works as expected:
% lsearch -exact -real {0 1.0} 1.00
1
% lsearch -exact -real {0 1.0} 1
1
I concede that it would make sense for the -real option (and a few other options) to imply -exact.
Schelte
The matching style for lsearch defaults to -glob. The -real option is
only meaningful when used with the -exact option. And then it works as expected:
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,073 |
Nodes: | 10 (0 / 10) |
Uptime: | 218:38:05 |
Calls: | 13,783 |
Calls today: | 1 |
Files: | 186,987 |
D/L today: |
524 files (165M bytes) |
Messages: | 2,434,752 |