Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,14 @@
;; Point is [x y] tuple
(defn compute-line [pt1 pt2]
(let [[x1 y1] pt1
[x2 y2] pt2
m (/ (- y2 y1) (- x2 x1))]
{:slope m
:offset (- y1 (* m x1))}))
(defn intercept [line1 line2]
(let [x (/ (- (:offset line1) (:offset line2))
(- (:slope line2) (:slope line1)))]
{:x x
:y (+ (* (:slope line1) x)
(:offset line1))}))