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,089 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 153:53:41 |
| Calls: | 13,921 |
| Calls today: | 2 |
| Files: | 187,021 |
| D/L today: |
3,760 files (944M bytes) |
| Messages: | 2,457,163 |