]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branches 'master' and 'cleanup' into cleanup
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Jan 2011 02:35:13 +0000 (18:35 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Jan 2011 02:35:13 +0000 (18:35 -0800)
basis/help/tutorial/tutorial.factor
extra/math/finance/finance-tests.factor
extra/math/finance/finance.factor

index ee22782fdcfd4f97133683c6baf67fb3dec72601..c4f332ed8ed8a604eb6f407d595edf26a389cd2e 100644 (file)
@@ -24,7 +24,7 @@ $nl
 ARTICLE: "first-program-logic" "Writing some logic in your first program"
 "Your " { $snippet "palindrome.factor" } " file should look like the following after the previous section:"
 { $code
-    "! Copyright (C) 2009 <your name here>"
+    "! Copyright (C) 2010 <your name here>"
     "! See http://factorcode.org/license.txt for BSD license."
     "USING: ;"
     "IN: palindrome"
@@ -127,7 +127,7 @@ $nl
 "Finally, pass the string and the quotation to the " { $link filter } " word:"
 { $code "filter" }
 "Now the stack should contain the following string:"
-{ "\"AmanaplanacanalPanama\"" }
+{ "\"AmanaplanacanalPanama\"" } ". "
 "This is almost what we want; we just need to convert the string to lower case now. This can be done by calling " { $link >lower } "; the " { $snippet ">" } " prefix is a naming convention for conversion operations, and should be read as “to”:"
 { $code ">lower" }
 "Finally, let's print the top of the stack and discard it:"
index fc4ad0d07e928244d253fd5fa257be263c933d79..eb4b238f6157416ca30f3a1bf0124b5dea77485e 100644 (file)
@@ -2,6 +2,8 @@ USING: kernel math math.functions math.finance tools.test ;
 
 IN: math.finance.tests
 
+[ { 1 2 3 4 } ] [ { 1 2 3 4 5 } 1 ema ] unit-test
+
 [ { 2 4 } ] [ { 1 3 5 } 2 sma ] unit-test
 
 [ { 1 3 1 } ] [ { 1 3 2 6 3 } 2 momentum ] unit-test
index f1c608bad912017f37f4afce36f527952f61544c..12f58c891bf9a2fd79a3f138fe2f0b055cde2bd8 100644 (file)
@@ -15,7 +15,7 @@ IN: math.finance
 PRIVATE>
 
 : ema ( seq n -- newseq )
-    a swap unclip [ [ dup ] 2dip spin weighted ] accumulate 2nip ;
+    a swap unclip [ swap pick weighted ] accumulate 2nip ;
 
 : sma ( seq n -- newseq )
     clump [ mean ] map ;