User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
algorithm:factorial_iterative [2013/04/13 19:33]
will
algorithm:factorial_iterative [2015/02/02 08:28] (current)
Line 1: Line 1:
-[algorithm factorial ​iterative]+======= λ Factorial - iterative ​======
  
-====== Algorithm ======+<​nowiki>​ 
 +======= Algorithm ​=======
 <syntax js> <syntax js>
 function fac(x) { function fac(x) {
Line 12: Line 13:
 </​syntax>​ </​syntax>​
  
-====== Support ======+======= Support ​=======
 <syntax js> <syntax js>
 function run() { function run() {
-    fac(50);+    ​return ​fac(50);
 } }
 </​syntax>​ </​syntax>​
  
-====== Visualisation ======+======= Tests ======= 
 +<syntax js> 
 +function testTen() { 
 +    assert (fac(10) === 3628800, "​fac(10)"​);​ 
 +
 + 
 +function testSeven() { 
 +    assert (fac(7) === 5040 , "​fac(7)"​);​ 
 +}</​syntax>​ 
 + 
 +======= Options ======= 
 +<syntax js> 
 +
 +    "​title":"​Factorial - iterative",​ 
 +    "​height":"​150px"​ 
 +
 +</​syntax>​ 
 + 
 +======= Visualisation ​=======
 <syntax html> <syntax html>
 <​html>​ <​html>​
Line 29: Line 48:
             var html = "";​             var html = "";​
             if (r) {             if (r) {
-                html = "n = " + r;+                html = ""​ + r;
             }             }
             else {             else {
Line 43: Line 62:
     </​script>​     </​script>​
   </​head>​   </​head>​
-  <body id="​container" style="​height:​150px">+  <body id="​container">​
   </​body>​   </​body>​
 </​html>​ </​html>​
 </​syntax>​ </​syntax>​
 +</​nowiki>​
algorithm/factorial_iterative.1365906838.txt.gz · Last modified: 2015/02/02 08:23 (external edit)