Minor stack shuffling changes

db4
Aaron Schaefer 2008-11-08 15:30:28 -05:00
parent 380cd2d3b0
commit 23ec6ef122
2 changed files with 3 additions and 3 deletions

View 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* <= [

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