new accessors

db4
Doug Coleman 2008-08-30 21:59:18 -05:00
parent 3891a7df74
commit 3eaa63b03a
1 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@
USING: kernel math math.functions math.vectors sequences self ;
USING: kernel math math.functions math.vectors sequences self
accessors ;
IN: pos
@ -9,13 +10,13 @@ TUPLE: pos val ;
C: <pos> pos
: pos> ( -- val ) self> pos-val ;
: pos> ( -- val ) self> val>> ;
: >pos ( val -- ) self> set-pos-val ;
: >pos ( val -- ) self> (>>val) ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: distance ( pos pos -- n ) pos-val swap pos-val v- [ sq ] map sum sqrt ;
: distance ( pos pos -- n ) val>> swap val>> v- [ sq ] map sum sqrt ;
: move-by ( point -- ) pos> v+ >pos ;