math.scm 368 B

12345678910111213141516
  1. (define-module (math))
  2. ;; hopefully this module will provide some procedures to calculate
  3. ;; various mathematical formulas
  4. (define (double x)
  5. (* x x))
  6. (define (distance-xy-points (a b))
  7. (let ([x1 (car a)]
  8. [x2 (car b)]
  9. [y1 (car (cdr a))]
  10. [y2 (car (cdr b))])
  11. (sqrt (+ (double (abs (- x1 x2)))
  12. (double (abs (- y1 y2)))))))