numbersschemer6rs

notation in r6rs grammar for complex numbers


In r6rs grammar for numbers there is this rule:

<complex r>  => ....  | <real r> @ <real r>

If I evaluate in mit-scheme the "number" 2@2 I get this strange complex number.

1 ]=> 2@2

;Value: -.8322936730942848+1.8185948536513634i

I did not find documented anywhere what this rule means, what kind of numbers one can generate with this syntax. Where could I find some definition of this? Where this notation comes from?

EDIT:

I found this link. The notation dates back to 1985.


Solution

  • It's polar notation for complex numbers <magnitude>@<angle>. I've never found documentation for it other than the syntax but I'd guess that <angle> is in radians.

    (magnitude 2@2) => 2.
    (angle 2@2) => 2.