Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 27 |
Nodes: | 6 (0 / 6) |
Uptime: | 46:38:40 |
Calls: | 632 |
Calls today: | 3 |
Files: | 1,187 |
D/L today: |
24 files (29,813K bytes) |
Messages: | 176,485 |
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: