Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5c8b9de9ac
Fetching contributors…

Cannot retrieve contributors at this time

28 lines (23 sloc) 0.791 kb
(load-file "sources/embedded-functions.clj")
(def Point
(fn [x y]
{:x x,
:y y
:__class_symbol__ 'Point
:__methods__ {
:class :__class_symbol__
;; should just be :x and :y
:x (fn [this] (:x this))
:y (fn [this] (:y this))
:add (fn [this other-point]
(make Point (+ (send-to this :x) (send-to other-point :x))
(+ (send-to this :y) (send-to other-point :y))))
:shift (fn [this xinc yinc]
(make Point (+ (send-to this :x) xinc)
(+ (send-to this :y) yinc)))}}))
(def test_point
(make Point 1 1))
(def test_point2
(make Point 2 3))
(prn (send-to test_point :shift 1 1))
(prn (send-to test_point :add test_point2))
Jump to Line
Something went wrong with that request. Please try again.