]> gitweb.factorcode.org Git - factor.git/commitdiff
Minor stack shuffling changes
authorAaron Schaefer <aaron@elasticdog.com>
Sat, 8 Nov 2008 20:30:28 +0000 (15:30 -0500)
committerAaron Schaefer <aaron@elasticdog.com>
Sat, 8 Nov 2008 20:30:28 +0000 (15:30 -0500)
extra/math/erato/erato.factor
extra/math/finance/finance.factor

index 894905e4057b28a1b948323ce1d5c30bc4e01867..7f9262380c0c427e34bc1576a050dfd7fa45ea0f 100644 (file)
@@ -15,7 +15,7 @@ TUPLE: erato limit bits latest ;
     [ ind ] [ bits>> ] bi* nth ; inline
 
 : indices ( n erato -- range )
-    limit>> ind over 3 * ind swap rot <range> ;
+    limit>> ind over 3 * ind spin <range> ;
 
 : mark-multiples ( n erato -- )
     2dup [ sq ] [ limit>> ] bi* <= [
index f006e6aee78502d752bec92537da7bbd2b5133c7..e02f4be6240b6dfd07f4bc73fa7696072961da76 100644 (file)
@@ -7,7 +7,7 @@ IN: math.finance
 <PRIVATE
 
 : weighted ( x y a -- z )
-    tuck [ * ] [ 1 swap - * ] 2bi* + ;
+    tuck [ * ] [ 1- neg * ] 2bi* + ;
 
 : a ( n -- a )
     1+ 2 swap / ;
@@ -15,7 +15,7 @@ IN: math.finance
 PRIVATE>
 
 : ema ( seq n -- newseq )
-    a swap unclip [ [ dup ] 2dip swap rot weighted ] accumulate 2nip ;
+    a swap unclip [ [ dup ] 2dip spin weighted ] accumulate 2nip ;
 
 : sma ( seq n -- newseq )
     clump [ mean ] map ;