Permalink
Browse files

prod.

  • Loading branch information...
1 parent 832b4ba commit 1a3757a961a3b0b71e6d189d61c0387a31238e59 @marcotmarcot committed Oct 11, 2012
Showing with 3 additions and 1 deletion.
  1. +1 −0 Scilab/Interpreter.hs
  2. +2 −1 tests/tests.hs
View
@@ -153,6 +153,7 @@ eval (ECall "disp" [e]) = disp e >> return undefined
eval (ECall "sqrt" [e]) = dofD sqrt e
eval (ECall "factorial" [e]) = dofD (product . enumFromTo 1) e
eval (ECall "sum" [e]) = vf V.sum e
+eval (ECall "prod" [e]) = vf V.product e
eval (ECall "printf" (_ : es)) = mapM_ disp es >> return undefined
eval (ECall "max" [e]) = vf V.maximum e
eval (ECall "min" [e]) = vf V.minimum e
View
@@ -137,7 +137,8 @@ execution
~=? interpret
[25.0,76.0,43.0,29.0,5.0,30.0,63.0,34.0,52.0,98.0,89.0,24.0,82.0,10.0,76.0,90.0,95.0,94.0,30.0,7.0,59.0,66.0,63.0,76.0,1.0,13.0,62.0,79.0,97.0,93.0,23.0,80.0,65.0,34.0,46.0,74.0,7.0,3.0,97.0,87.0,36.0,37.0,51.0,75.0,72.0,43.0,52.0,32.0,69.0,47.0,16.0,22.0,78.0,68.0,70.0,79.0,78.0,78.0,52.0,51.0,97.0,21.0,34.0,2.0,66.0,3.0,87.0,16.0,97.0,99.0,49.0,17.0,6.0,96.0,43.0,79.0,44.0,51.0,13.0,47.0,32.0,14.0,85.0,65.0,38.0,46.0,53.0,34.0,94.0,60.0,12.0,60.0,13.0,96.0,16.0,13.0,34.0,58.0,71.0,11.0]
("for i = 1 : 10; for j = 1 : 10; M(i, j) = input(); end; end;"
- <> "for i = 1 : 10; disp(M(i, i)); end")]
+ <> "for i = 1 : 10; disp(M(i, i)); end"),
+ ([], [24]) ~=? interpret [] "disp(prod(1 : 4))"]
others :: Test
others

0 comments on commit 1a3757a

Please sign in to comment.