flan/test/syntax/mixed/geo/geo.flan

11 lines
262 B
Plaintext

;;;; A package written in the paren syntax, imported by ../main.fln.
(defstruct Pt [x i32 y i32])
(defn pt [x i32 y i32] Pt (Pt {.x x .y y}))
(defn dist2 [a Pt b Pt] i32
(let [dx (- (.x a) (.x b))
dy (- (.y a) (.y b))]
(+ (* dx dx) (* dy dy))))