How to determine signed integer?
-
- Posts: 95
- Joined: Wed Oct 13, 2004 8:02 pm
- Location: Bellingham WA
How to determine signed integer?
I have a situation where I want to determine if my function received +2 vs just 2 from the user. If I use "integer?" as my test both versions return true. If I try using "string" both values return "2". Is there any way to identify a positive signed integer versus a positive unsigned integer? If not, could "string" be modified to return the input literally?
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
A thought: if r is "+2" and s is "2", then the following is true:
ie they're the same thing but different lengths. Trouble is, it might be true for other pairs of strings...?
Code: Select all
(and (= (eval-string r) (eval-string s)) (!= (length r) (length s)))