: sq dup * ; : keep over { call } dip ; : mag@ 'mag@ print 'x @ dup print sq 'y @ dup print sq + sqrt ; : move@ 'y @ + 'y =@ 'x @ + 'x =@ ; : :mag 'mag swap call ; : :move 'move swap call ; : {point-methods} { { dup 'get = } { pop @ } { dup 'set = } { pop =@ } { dup 'mag = } { pop mag@ } { dup 'move = } { pop move@ } } ; : [point] {point-methods} [ 'methods @ cond ] { 'x 'y 'methods } bind ; 10 20 [point] 'position =@ -7 -16 'position @ { :move } keep :mag