Permalink
Browse files

New demo.

  • Loading branch information...
1 parent 1e7682b commit eac7169f7a054dd1e45403499a9262892e556060 Sebastiaan Visser committed Dec 20, 2009
Showing with 30 additions and 54 deletions.
  1. +1 −1 src/Main.hs
  2. +29 −53 src/test.js
View
@@ -6,7 +6,7 @@ import Lang.JavaScript
import qualified Prelude as P
jsList :: Js [Num]
-jsList = 1 `cons` (2 `cons` (3 `cons` (4 `cons` (5 `cons` (6 `cons` (7 `cons` nil))))))
+jsList = replicate 700 1
jsSumList :: Js Num
jsSumList = sum (jsList ++ jsList) * sum jsList
View
@@ -1,59 +1,35 @@
add = (function (v5){ return (function (v6){ return v5 + v6; }); })
-cons = (function (v3){ return (function (v4){ return { head : v3, tail : v4 }; }); })
+bool = (function (v5){ return (function (v6){ return (function (v7){ return v7 ? v5(null) : v6(null); }); }); })
+cons = (function (v6){ return (function (v7){ return { head : v6, tail : v7 }; }); })
+eq = (function (v5){ return (function (v6){ return v5 == v6; }); })
fix = (function (v1){ return fix = arguments.callee, v1(function (i) { return fix(v1)(i) }); })
list = (function (v3){ return (function (v4){ return (function (v5){ return v5.nil ? v3 : v4(v5.head)(v5.tail); }); }); })
mul = (function (v1){ return (function (v2){ return v1 * v2; }); })
+sub = (function (v6){ return (function (v7){ return v6 - v7; }); })
c1 = list(0)
c2 = fix((function (v1){ return (function (v2){ return c1((function (v3){ return (function (v4){ return add(v3)(v1(v4)); }); }))(v2); }); }))
-c3 = cons(1)
-c4 = cons(2)
-c5 = cons(3)
-c6 = cons(4)
-c7 = cons(5)
-c8 = cons(6)
-c9 = cons(7)
-c10 = c9({ nil : 1 })
-c11 = c8(c10)
-c12 = c7(c11)
-c13 = c6(c12)
-c14 = c5(c13)
-c15 = c4(c14)
-c16 = c3(c15)
-c17 = list(c16)
-c18 = fix((function (v1){ return (function (v2){ return c17((function (v3){ return (function (v4){ return cons(v3)(v1(v4)); }); }))(v2); }); }))
-c19 = cons(1)
-c20 = cons(2)
-c21 = cons(3)
-c22 = cons(4)
-c23 = cons(5)
-c24 = cons(6)
-c25 = cons(7)
-c26 = c25({ nil : 1 })
-c27 = c24(c26)
-c28 = c23(c27)
-c29 = c22(c28)
-c30 = c21(c29)
-c31 = c20(c30)
-c32 = c19(c31)
-c33 = c18(c32)
-c34 = c2(c33)
-c35 = mul(c34)
-c36 = list(0)
-c37 = fix((function (v1){ return (function (v2){ return c36((function (v3){ return (function (v4){ return add(v3)(v1(v4)); }); }))(v2); }); }))
-c38 = cons(1)
-c39 = cons(2)
-c40 = cons(3)
-c41 = cons(4)
-c42 = cons(5)
-c43 = cons(6)
-c44 = cons(7)
-c45 = c44({ nil : 1 })
-c46 = c43(c45)
-c47 = c42(c46)
-c48 = c41(c47)
-c49 = c40(c48)
-c50 = c39(c49)
-c51 = c38(c50)
-c52 = c37(c51)
-c53 = c35(c52)
-__main = c53
+c3 = (function (v6){ return (function (v7){ return v6; }); })({ nil : 1 })
+c4 = bool((function (v5){ return c3(v5); }))
+c5 = cons(1)
+c6 = fix((function (v3){ return (function (v4){ return c4((function (v5){ return (function (v6){ return (function (v7){ return v6; }); })(c5(v3(sub(v4)(1))))(v5); }))(eq(v4)(0)); }); }))
+c7 = c6(700)
+c8 = list(c7)
+c9 = fix((function (v1){ return (function (v2){ return c8((function (v3){ return (function (v4){ return cons(v3)(v1(v4)); }); }))(v2); }); }))
+c10 = (function (v4){ return (function (v5){ return v4; }); })({ nil : 1 })
+c11 = bool((function (v3){ return c10(v3); }))
+c12 = cons(1)
+c13 = fix((function (v1){ return (function (v2){ return c11((function (v3){ return (function (v4){ return (function (v5){ return v4; }); })(c12(v1(sub(v2)(1))))(v3); }))(eq(v2)(0)); }); }))
+c14 = c13(700)
+c15 = c9(c14)
+c16 = c2(c15)
+c17 = mul(c16)
+c18 = list(0)
+c19 = fix((function (v1){ return (function (v2){ return c18((function (v3){ return (function (v4){ return add(v3)(v1(v4)); }); }))(v2); }); }))
+c20 = (function (v4){ return (function (v5){ return v4; }); })({ nil : 1 })
+c21 = bool((function (v3){ return c20(v3); }))
+c22 = cons(1)
+c23 = fix((function (v1){ return (function (v2){ return c21((function (v3){ return (function (v4){ return (function (v5){ return v4; }); })(c22(v1(sub(v2)(1))))(v3); }))(eq(v2)(0)); }); }))
+c24 = c23(700)
+c25 = c19(c24)
+c26 = c17(c25)
+__main = c26

0 comments on commit eac7169

Please sign in to comment.