ashinn / chibi-scheme

Official chibi-scheme repository
Other
1.21k stars 142 forks source link

Compare complex numbers #934

Closed lassik closed 3 months ago

lassik commented 1 year ago
> (< -3-4i 0)
#f

> (< 0 -3-4i)
#f

> (< -3-4i -3-4i)
ERROR on line X: invalid type, expected Number: -3-4i

> (< 0 -3-4i -3-4i)
ERROR on line X: invalid type, expected Number: -3-4i

R7RS says < <= > >= are only defined for real numbers. = is defined for all numbers.

lassik commented 1 year ago

cc @jpellegrini

jpellegrini commented 1 year ago

Perhaps also Chibi could either produce an error or compute the norm of the number when abs is applied to a complex argument? https://docs.scheme.org/surveys/complex-abs/