Re: How to model a rectangle?

2015-03-05 Thread Felix E. Klee
Looks interesting, thanks! On Thu, Mar 5, 2015 at 4:43 PM, Leon Grapenthin wrote: > (defn rect2 [x y width height] > (let [lr [(+ width x) (+ width y)]] > (reify Rect > (upper-left [_] [x y]) > (lower-right [_] lr) > (area [_] (* width height) Just a quick remark: In

How to model a rectangle?

2015-03-05 Thread Felix E. Klee
Disclaimer: I’ve never done *any* Clojure programming, but I’m curious. Here’s how I may model an on-screen rectangle in JavaScript, a classless object oriented language: let createRectangle = function (x, y, width, height) { return { get upperLeft() { retu