flan/test/programs/pkgs/shape/shape.flan

13 lines
503 B
Plaintext

;;;; The bottom of the diamond: the one package both middles depend on.
;;;;
;;;; Box has to be one type. If this directory were read twice — once along
;;;; area/, once along draw/ — there would be two defstructs both qualified
;;;; shape/Box, and the checker would either refuse the collision or, worse,
;;;; unify nothing. That is the failure this tree exists to catch.
(defstruct Box [w i32 h i32])
(defn box [w i32 h i32] Box (Box {.w w .h h}))
(defn is-wide [b Box] bool (> (.w b) (.h b)))