]> gitweb.factorcode.org Git - factor.git/commitdiff
Clean up of math.finance
authorAaron Schaefer <aaron@elasticdog.com>
Fri, 7 Nov 2008 06:36:02 +0000 (01:36 -0500)
committerAaron Schaefer <aaron@elasticdog.com>
Fri, 7 Nov 2008 06:36:02 +0000 (01:36 -0500)
extra/math/finance/finance.factor

index db300a3b70b709fc207eefebce4cbea14d856f4e..f006e6aee78502d752bec92537da7bbd2b5133c7 100644 (file)
@@ -1,18 +1,16 @@
-! Copyright (C) 2008 John Benediktsson
-! See http://factorcode.org/license.txt for BSD license
-
+! Copyright (C) 2008 John Benediktsson.
+! See http://factorcode.org/license.txt for BSD license.
 USING: arrays assocs kernel grouping sequences shuffle
 math math.functions math.statistics math.vectors ;
-
 IN: math.finance
 
 <PRIVATE
 
-: weighted ( x y a -- z ) 
+: weighted ( x y a -- z )
     tuck [ * ] [ 1 swap - * ] 2bi* + ;
 
-: a ( n -- a ) 
-    1 + 2 swap / ;
+: a ( n -- a )
+    1+ 2 swap / ;
 
 PRIVATE>
 
@@ -26,6 +24,5 @@ PRIVATE>
     rot dup ema [ swap ema ] dip v- ;
 
 : momentum ( seq n -- newseq )
-    2dup tail-slice -rot swap [ length ] keep
-    [ - neg ] dip swap head-slice v- ;
+    [ tail-slice ] 2keep [ dup length ] dip - head-slice v- ;