]> gitweb.factorcode.org Git - factor.git/blobdiff - unmaintained/4DNav/turtle/turtle.factor
tools.test: Make the flag public. Finish porting tester changes to fuzzer.
[factor.git] / unmaintained / 4DNav / turtle / turtle.factor
old mode 100755 (executable)
new mode 100644 (file)
index 62c25c4..4f89964
@@ -1,11 +1,16 @@
-USING: kernel math arrays math.vectors math.matrices
-namespaces make
-math.constants math.functions
-math.vectors
-splitting grouping self math.trig
-  sequences accessors 4DNav.deep models ;
+USING: kernel math arrays math.vectors math.matrices namespaces make
+math.constants math.functions splitting grouping math.trig sequences
+accessors 4DNav.deep models vars ;
 IN: 4DNav.turtle
 
+! replacement of self
+
+VAR: self
+
+: with-self ( quot obj -- ) [ >self call ] with-scope ; inline
+
+: save-self ( quot -- ) self> [ self> clone >self call ] dip >self ; inline
+
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 TUPLE: turtle pos ori ;
@@ -27,10 +32,10 @@ TUPLE: observer < turtle projection-mode collision-mode ;
 
 
 : turtle-pos> ( -- val ) self> pos>> ;
-: >turtle-pos ( val -- ) self> (>>pos) ;
+: >turtle-pos ( val -- ) self> pos<< ;
 
 : turtle-ori> ( -- val ) self> ori>> ;
-: >turtle-ori ( val -- ) self> (>>ori) ;
+: >turtle-ori ( val -- ) self> ori<< ;
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
@@ -114,7 +119,7 @@ TUPLE: observer < turtle projection-mode collision-mode ;
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : distance ( turtle turtle -- n ) 
-    pos>> swap pos>> v- [ sq ] map sum sqrt ;
+    pos>> swap pos>> v- [ sq ] map-sum sqrt ;
 
 : move-by ( point -- ) turtle-pos> v+ >turtle-pos ;