> Yes, I know that -1 is a valid truth value. > > So the first time you care is the first time f(x, y) returns nonzero. > Now you can find out what kind of function f is by calling f(y, x). > If f(y, x) returns zero, f is <. Otherwise, it's a 3-way comparison. I think the worry is that the function might be saying "true" to both of these, but just happen to spell it 1 the first time and -1 the second. Probably fairly unlikely, though... Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4