Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (16 sloc) 362 Bytes
#lang liso
@require:
"proxy.liso"
@define-proxy point[x, y]:
.x => x
.y => y
.abs => {x * x + y * y} ** 0.5
[i] => @match i:
0 => x
1 => y
.add => [p2] -> point[x + p2.x, y + p2.y]
.tostring => format["point[~a, ~a]", x, y]
p = point[3, 4]
p[0] ;; 3
p.abs ;; 5.0
p.add[point[8, -1]].tostring ;; "point[11, 3]"