Kind of follow-up to http://arclanguage.org/item?id=10188 Problem: arc(3.1)> (= intg 2)
2
arc> (coerce intg 'num)
2
arc> (type (coerce intg 'num))
int
arc> (isa (coerce intg 'num) 'num)
nil
Eventual patch, in the definition of 'ar-coerce in ac.scm, change: ((exint? x) (case type
((num) x)
by: ((exint? x) (case type
((num) (exact->inexact x))
w/patch: arc> (= intg 2)
2
arc> (type intg)
int
arc> (coerce intg 'num)
2.0
arc> (type (coerce intg 'num))
num
arc> (isa (coerce intg 'num) 'num)
t
------However, this is just my opinion, this is pedantic, this is a bit playing on terminology, and this would be more difficult to patch, but I expect: arc> (isa intg 'num)
t
An integer is a number after all (Z ⊆ C). If you want to know if intg is a "non-integer number" or not, you could always check (~isa intg int).What do you people think about all this? |