new accessors
parent
3891a7df74
commit
3eaa63b03a
|
@ -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 ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue