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,075 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 100:22:48 |
| Calls: | 13,798 |
| Calls today: | 1 |
| Files: | 186,990 |
| D/L today: |
8,316 files (2,338M bytes) |
| Messages: | 2,438,700 |