Lutz,
I would like to suggest modifying the equality operators so that they behave differently when presented with a single number as input. Currently an expression like (< 3) always returns true. If n is an input I want to propose that the equality operators behave as follows:
(f n) is (f n 0) where f are the operators <.<=,>,>=,=,!=
This makes testing a number simple to see if it is negative, strictly positive, etc.
Defaults for equality operators
-
- Posts: 95
- Joined: Wed Oct 13, 2004 8:02 pm
- Location: Bellingham WA
I thought it was a nice idea at first but then ran into all kinds of situations, thinking of an implementation. Remember that the comparison operators work on all datatypes and also do comparison between data types.
But I will revisit the idea at a later time.
There is also the 'sgn' function which has the added faeture that it can call other functions.
Lutz
But I will revisit the idea at a later time.
There is also the 'sgn' function which has the added faeture that it can call other functions.
Lutz
... look for it in 9.0.12 (for numbers, strings and lists)
Lutz
Lutz
Last edited by Lutz on Sun Dec 24, 2006 6:35 pm, edited 1 time in total.
-
- Posts: 95
- Joined: Wed Oct 13, 2004 8:02 pm
- Location: Bellingham WA