Clean up of math.finance

db4
Aaron Schaefer 2008-11-07 01:36:02 -05:00
parent 2fafae5013
commit 380cd2d3b0
1 changed files with 6 additions and 9 deletions

View 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- ;