#10: Using Degrees

Tagged as challenge

Written on 2018-01-30

For better or for worse, some disciplines use degrees as a measure of angle. Write a macro with-degrees which causes the trigonometric functions sin, cos, and tan to use degrees and not radians within the lexical scope of with-degrees. For example,

  (+ (sin 30) (sin 90)))

should return 1.5.

Note: This is much less straightforward in Common Lisp than it is in Scheme due to Common Lisp's packaging rules.

Unless otherwise credited all material copyright © 2010–2018 by Robert Smith