1 |
|
2 | var testTemplate = function(one,two,three) {
|
3 | return ["1",one,"2",two,"3",three].join('');
|
4 | };
|
5 | var lispyscript = function() {
|
6 | return (function() {
|
7 | return Array.prototype.slice.call(arguments);
|
8 | })(((true === (true === true)) ?
|
9 | ("Passed - " + "(true? true)") :
|
10 | ("Failed - " + "(true? true)")),((true === (false === false)) ?
|
11 | ("Passed - " + "(false? false)") :
|
12 | ("Failed - " + "(false? false)")),((true === (false === (true === {}))) ?
|
13 | ("Passed - " + "(false? (true? {}))") :
|
14 | ("Failed - " + "(false? (true? {}))")),((true === (typeof(undefined) === "undefined")) ?
|
15 | ("Passed - " + "(undefined? undefined)") :
|
16 | ("Failed - " + "(undefined? undefined)")),((true === (false === (typeof(null) === "undefined"))) ?
|
17 | ("Passed - " + "(false? (undefined? null))") :
|
18 | ("Failed - " + "(false? (undefined? null))")),((true === (null === null)) ?
|
19 | ("Passed - " + "(null? null)") :
|
20 | ("Failed - " + "(null? null)")),((true === (false === (undefined === null))) ?
|
21 | ("Passed - " + "(false? (null? undefined))") :
|
22 | ("Failed - " + "(false? (null? undefined))")),((true === (0 === 0)) ?
|
23 | ("Passed - " + "(zero? 0)") :
|
24 | ("Failed - " + "(zero? 0)")),((true === (false === (0 === ''))) ?
|
25 | ("Passed - " + "(false? (zero? ''))") :
|
26 | ("Failed - " + "(false? (zero? ''))")),((true === (typeof(true) === "boolean")) ?
|
27 | ("Passed - " + "(boolean? true)") :
|
28 | ("Failed - " + "(boolean? true)")),((true === (false === (typeof(0) === "boolean"))) ?
|
29 | ("Passed - " + "(false? (boolean? 0))") :
|
30 | ("Failed - " + "(false? (boolean? 0))")),((true === (Object.prototype.toString.call(1) === "[object Number]")) ?
|
31 | ("Passed - " + "(number? 1)") :
|
32 | ("Failed - " + "(number? 1)")),((true === (false === (Object.prototype.toString.call('') === "[object Number]"))) ?
|
33 | ("Passed - " + "(false? (number? ''))") :
|
34 | ("Failed - " + "(false? (number? ''))")),((true === (Object.prototype.toString.call('') === "[object String]")) ?
|
35 | ("Passed - " + "(string? '')") :
|
36 | ("Failed - " + "(string? '')")),((true === (Object.prototype.toString.call([]) === "[object Array]")) ?
|
37 | ("Passed - " + "(array? []])") :
|
38 | ("Failed - " + "(array? []])")),((true === (false === (Object.prototype.toString.call({}) === "[object Array]"))) ?
|
39 | ("Passed - " + "(false? (array? {}))") :
|
40 | ("Failed - " + "(false? (array? {}))")),((true === (function(obj) {
|
41 | return (obj === Object(obj));
|
42 | })({})) ?
|
43 | ("Passed - " + "(object? {})") :
|
44 | ("Failed - " + "(object? {})")),((true === (function(obj) {
|
45 | return (obj === Object(obj));
|
46 | })([])) ?
|
47 | ("Passed - " + "(object? [])") :
|
48 | ("Failed - " + "(object? [])")),((true === (false === (function(obj) {
|
49 | return (obj === Object(obj));
|
50 | })(null))) ?
|
51 | ("Passed - " + "(false? (object? null))") :
|
52 | ("Failed - " + "(false? (object? null))")),((true === (10 === (true ?
|
53 | (function() {
|
54 | var ret = 10;
|
55 | return ret;
|
56 | })() :
|
57 | undefined))) ?
|
58 | ("Passed - " + "when test") :
|
59 | ("Failed - " + "when test")),((true === (10 === ((!false) ?
|
60 | (function() {
|
61 | return (function() {
|
62 | var ret = 10;
|
63 | return ret;
|
64 | })();
|
65 | })() :
|
66 | undefined))) ?
|
67 | ("Passed - " + "unless test") :
|
68 | ("Failed - " + "unless test")),((true === (-10 === (function() {
|
69 | var i = -1;
|
70 | return ((i < 0) ?
|
71 | -10 :
|
72 | ((0 === i) ?
|
73 | 0 :
|
74 | ((i > 0) ?
|
75 | 10 :
|
76 | undefined)));
|
77 | })())) ?
|
78 | ("Passed - " + "condition test less than") :
|
79 | ("Failed - " + "condition test less than")),((true === (10 === (function() {
|
80 | var i = 1;
|
81 | return ((i < 0) ?
|
82 | -10 :
|
83 | ((0 === i) ?
|
84 | 0 :
|
85 | ((i > 0) ?
|
86 | 10 :
|
87 | undefined)));
|
88 | })())) ?
|
89 | ("Passed - " + "condition test greater than") :
|
90 | ("Failed - " + "condition test greater than")),((true === (0 === (function() {
|
91 | var i = 0;
|
92 | return ((i < 0) ?
|
93 | -10 :
|
94 | ((0 === i) ?
|
95 | 0 :
|
96 | ((i > 0) ?
|
97 | 10 :
|
98 | undefined)));
|
99 | })())) ?
|
100 | ("Passed - " + "condition test equal to") :
|
101 | ("Failed - " + "condition test equal to")),((true === (10 === (function() {
|
102 | var i = Infinity;
|
103 | return ((i < 0) ?
|
104 | -10 :
|
105 | ((0 === i) ?
|
106 | 0 :
|
107 | (true ?
|
108 | 10 :
|
109 | undefined)));
|
110 | })())) ?
|
111 | ("Passed - " + "condition test default") :
|
112 | ("Failed - " + "condition test default")),((true === (10 === (function() {
|
113 | var recur = null;
|
114 | var ___result = !undefined;
|
115 | var ___nextArgs = null;
|
116 | var ___f = function(i) {
|
117 | return ((i === 10) ?
|
118 | i :
|
119 | recur(++i));
|
120 | };
|
121 | recur = function() {
|
122 | ___nextArgs = arguments;
|
123 | return ((___result === undefined) ?
|
124 | undefined :
|
125 | (function() {
|
126 | ___result = undefined;
|
127 | while(___result===undefined) ___result=___f.apply(this,___nextArgs);
|
128 | return ___result;
|
129 | })());
|
130 | };
|
131 | return recur(1);
|
132 | })())) ?
|
133 | ("Passed - " + "loop recur test") :
|
134 | ("Failed - " + "loop recur test")),((true === (10 === (function() {
|
135 | var ret = 0;
|
136 | (function(o,f,s) {
|
137 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
138 | return undefined;
|
139 | })((function() {
|
140 | return Array.prototype.slice.call(arguments);
|
141 | })(1,2,3,4),function(val) {
|
142 | ret = (ret + val);
|
143 | });
|
144 | return ret;
|
145 | })())) ?
|
146 | ("Passed - " + "each test") :
|
147 | ("Failed - " + "each test")),((true === (10 === (function() {
|
148 | var ret = 0;
|
149 | (function(o,f,s) {
|
150 | var _k;if(Object.keys){_k=Object.keys(o);}else{_k=[];for(var i in o)_k.push(i);}
|
151 | return (function(o,f,s) {
|
152 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
153 | return undefined;
|
154 | })(_k,function(elem) {
|
155 | return f.call(s,o[elem],elem,o);
|
156 | });
|
157 | })((function() {
|
158 | var _r = {};
|
159 | for(var i=0,l=arguments.length;i<l;i+=2){_r[arguments[i]]=arguments[i+1];}
|
160 | return _r;
|
161 | })("a",1,"b",2,"c",3,"d",4),function(val) {
|
162 | ret = (ret + val);
|
163 | });
|
164 | return ret;
|
165 | })())) ?
|
166 | ("Passed - " + "eachKey test") :
|
167 | ("Failed - " + "eachKey test")),((true === (10 === (function(arr,f,init) {
|
168 | var noInit = (arguments.length < 3);
|
169 | (function(o,f,s) {
|
170 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
171 | return undefined;
|
172 | })(arr,function(val,i,list) {
|
173 | return (((i === 0) && noInit) ?
|
174 | init = val :
|
175 | init = f(init,val,i,list));
|
176 | });
|
177 | return init;
|
178 | })((function() {
|
179 | return Array.prototype.slice.call(arguments);
|
180 | })(1,2,3,4),function(accum,val) {
|
181 | return (accum + val);
|
182 | },0))) ?
|
183 | ("Passed - " + "reduce test with init") :
|
184 | ("Failed - " + "reduce test with init")),((true === (10 === (function(arr,f,init) {
|
185 | var noInit = (arguments.length < 3);
|
186 | (function(o,f,s) {
|
187 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
188 | return undefined;
|
189 | })(arr,function(val,i,list) {
|
190 | return (((i === 0) && noInit) ?
|
191 | init = val :
|
192 | init = f(init,val,i,list));
|
193 | });
|
194 | return init;
|
195 | })((function() {
|
196 | return Array.prototype.slice.call(arguments);
|
197 | })(1,2,3,4),function(accum,val) {
|
198 | return (accum + val);
|
199 | }))) ?
|
200 | ("Passed - " + "reduce test without init") :
|
201 | ("Failed - " + "reduce test without init")),((true === (20 === (function(arr,f,init) {
|
202 | var noInit = (arguments.length < 3);
|
203 | (function(o,f,s) {
|
204 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
205 | return undefined;
|
206 | })(arr,function(val,i,list) {
|
207 | return (((i === 0) && noInit) ?
|
208 | init = val :
|
209 | init = f(init,val,i,list));
|
210 | });
|
211 | return init;
|
212 | })((function(arr,f,scope) {
|
213 | var _r = [];
|
214 | (function(o,f,s) {
|
215 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
216 | return undefined;
|
217 | })(arr,function(val,i,list) {
|
218 | return _r.push(f.call(scope,val,i,list));
|
219 | });
|
220 | return _r;
|
221 | })((function() {
|
222 | return Array.prototype.slice.call(arguments);
|
223 | })(1,2,3,4),function(val) {
|
224 | return (val * 2);
|
225 | }),function(accum,val) {
|
226 | return (accum + val);
|
227 | },0))) ?
|
228 | ("Passed - " + "map test") :
|
229 | ("Failed - " + "map test")),((true === ("112233" === testTemplate(1,2,3))) ?
|
230 | ("Passed - " + "template test") :
|
231 | ("Failed - " + "template test")),((true === ("112233" === (function() {
|
232 | var ___ret = "";
|
233 | (function(o,f,s) {
|
234 | var _k;if(Object.keys){_k=Object.keys(o);}else{_k=[];for(var i in o)_k.push(i);}
|
235 | return (function(o,f,s) {
|
236 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
237 | return undefined;
|
238 | })(_k,function(elem) {
|
239 | return f.call(s,o[elem],elem,o);
|
240 | });
|
241 | })({"1":1,"2":2,"3":3},function(value,key) {
|
242 | ___ret = (___ret + [key,value].join(''));
|
243 | });
|
244 | return ___ret;
|
245 | })())) ?
|
246 | ("Passed - " + "template repeat key test") :
|
247 | ("Failed - " + "template repeat key test")),((true === (10 === (function() {
|
248 | try {
|
249 | var i = 10;
|
250 | return i;
|
251 |
|
252 | } catch (e) {
|
253 | return (function(err) {
|
254 | })(e);
|
255 | }
|
256 | })())) ?
|
257 | ("Passed - " + "try catch test - try block") :
|
258 | ("Failed - " + "try catch test - try block")),((true === (10 === (function() {
|
259 | try {
|
260 | (function(){throw 10;})();
|
261 |
|
262 | } catch (e) {
|
263 | return (function(err) {
|
264 | return err;
|
265 | })(e);
|
266 | }
|
267 | })())) ?
|
268 | ("Passed - " + "try catch test - catch block") :
|
269 | ("Failed - " + "try catch test - catch block")),((true === (3 === (function(___monad) {
|
270 | var mBind = ___monad.mBind;
|
271 | var mResult = ___monad.mResult;
|
272 | var mZero = ___monad.mZero;
|
273 | var mPlus = ___monad.mPlus;
|
274 | var ____mResult = function(___arg) {
|
275 | return (((typeof(___arg) === "undefined") && (!(typeof(mZero) === "undefined"))) ?
|
276 | mZero :
|
277 | mResult(___arg));
|
278 | };
|
279 | return mBind(1,function(a) {
|
280 | return mBind((a * 2),function(b) {
|
281 | return (function() {
|
282 | return ____mResult((a + b));
|
283 | })();
|
284 | });
|
285 | });
|
286 | })((function() {
|
287 | var _r = {};
|
288 | for(var i=0,l=arguments.length;i<l;i+=2){_r[arguments[i]]=arguments[i+1];}
|
289 | return _r;
|
290 | })("mBind",function(mv,mf) {
|
291 | return mf(mv);
|
292 | },"mResult",function(v) {
|
293 | return v;
|
294 | })))) ?
|
295 | ("Passed - " + "Identity Monad Test") :
|
296 | ("Failed - " + "Identity Monad Test")),((true === (3 === (function(___monad) {
|
297 | var mBind = ___monad.mBind;
|
298 | var mResult = ___monad.mResult;
|
299 | var mZero = ___monad.mZero;
|
300 | var mPlus = ___monad.mPlus;
|
301 | var ____mResult = function(___arg) {
|
302 | return (((typeof(___arg) === "undefined") && (!(typeof(mZero) === "undefined"))) ?
|
303 | mZero :
|
304 | mResult(___arg));
|
305 | };
|
306 | return mBind(1,function(a) {
|
307 | return mBind((a * 2),function(b) {
|
308 | return (function() {
|
309 | return ____mResult((a + b));
|
310 | })();
|
311 | });
|
312 | });
|
313 | })((function() {
|
314 | var _r = {};
|
315 | for(var i=0,l=arguments.length;i<l;i+=2){_r[arguments[i]]=arguments[i+1];}
|
316 | return _r;
|
317 | })("mBind",function(mv,mf) {
|
318 | return ((mv === null) ?
|
319 | null :
|
320 | mf(mv));
|
321 | },"mResult",function(v) {
|
322 | return v;
|
323 | },"mZero",null)))) ?
|
324 | ("Passed - " + "maybe Monad Test") :
|
325 | ("Failed - " + "maybe Monad Test")),((true === (null === (function(___monad) {
|
326 | var mBind = ___monad.mBind;
|
327 | var mResult = ___monad.mResult;
|
328 | var mZero = ___monad.mZero;
|
329 | var mPlus = ___monad.mPlus;
|
330 | var ____mResult = function(___arg) {
|
331 | return (((typeof(___arg) === "undefined") && (!(typeof(mZero) === "undefined"))) ?
|
332 | mZero :
|
333 | mResult(___arg));
|
334 | };
|
335 | return mBind(null,function(a) {
|
336 | return mBind((a * 2),function(b) {
|
337 | return (function() {
|
338 | return ____mResult((a + b));
|
339 | })();
|
340 | });
|
341 | });
|
342 | })((function() {
|
343 | var _r = {};
|
344 | for(var i=0,l=arguments.length;i<l;i+=2){_r[arguments[i]]=arguments[i+1];}
|
345 | return _r;
|
346 | })("mBind",function(mv,mf) {
|
347 | return ((mv === null) ?
|
348 | null :
|
349 | mf(mv));
|
350 | },"mResult",function(v) {
|
351 | return v;
|
352 | },"mZero",null)))) ?
|
353 | ("Passed - " + "maybe Monad null Test") :
|
354 | ("Failed - " + "maybe Monad null Test")),((true === (54 === (function(arr,f,init) {
|
355 | var noInit = (arguments.length < 3);
|
356 | (function(o,f,s) {
|
357 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
358 | return undefined;
|
359 | })(arr,function(val,i,list) {
|
360 | return (((i === 0) && noInit) ?
|
361 | init = val :
|
362 | init = f(init,val,i,list));
|
363 | });
|
364 | return init;
|
365 | })((function(___monad) {
|
366 | var mBind = ___monad.mBind;
|
367 | var mResult = ___monad.mResult;
|
368 | var mZero = ___monad.mZero;
|
369 | var mPlus = ___monad.mPlus;
|
370 | var ____mResult = function(___arg) {
|
371 | return (((typeof(___arg) === "undefined") && (!(typeof(mZero) === "undefined"))) ?
|
372 | mZero :
|
373 | mResult(___arg));
|
374 | };
|
375 | return mBind([1,2,3],function(a) {
|
376 | return mBind([3,4,5],function(b) {
|
377 | return (function() {
|
378 | return ____mResult((a + b));
|
379 | })();
|
380 | });
|
381 | });
|
382 | })((function() {
|
383 | var _r = {};
|
384 | for(var i=0,l=arguments.length;i<l;i+=2){_r[arguments[i]]=arguments[i+1];}
|
385 | return _r;
|
386 | })("mBind",function(mv,mf) {
|
387 | return (function(arr,f,init) {
|
388 | var noInit = (arguments.length < 3);
|
389 | (function(o,f,s) {
|
390 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
391 | return undefined;
|
392 | })(arr,function(val,i,list) {
|
393 | return (((i === 0) && noInit) ?
|
394 | init = val :
|
395 | init = f(init,val,i,list));
|
396 | });
|
397 | return init;
|
398 | })((function(arr,f,scope) {
|
399 | var _r = [];
|
400 | (function(o,f,s) {
|
401 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
402 | return undefined;
|
403 | })(arr,function(val,i,list) {
|
404 | return _r.push(f.call(scope,val,i,list));
|
405 | });
|
406 | return _r;
|
407 | })(mv,mf),function(accum,val) {
|
408 | return accum.concat(val);
|
409 | },[]);
|
410 | },"mResult",function(v) {
|
411 | return [v];
|
412 | },"mZero",[],"mPlus",function() {
|
413 | return (function(arr,f,init) {
|
414 | var noInit = (arguments.length < 3);
|
415 | (function(o,f,s) {
|
416 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
417 | return undefined;
|
418 | })(arr,function(val,i,list) {
|
419 | return (((i === 0) && noInit) ?
|
420 | init = val :
|
421 | init = f(init,val,i,list));
|
422 | });
|
423 | return init;
|
424 | })(Array.prototype.slice.call(arguments),function(accum,val) {
|
425 | return accum.concat(val);
|
426 | },[]);
|
427 | })),function(accum,val) {
|
428 | return (accum + val);
|
429 | },0))) ?
|
430 | ("Passed - " + "arrayMonad test") :
|
431 | ("Failed - " + "arrayMonad test")),((true === (32 === (function(arr,f,init) {
|
432 | var noInit = (arguments.length < 3);
|
433 | (function(o,f,s) {
|
434 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
435 | return undefined;
|
436 | })(arr,function(val,i,list) {
|
437 | return (((i === 0) && noInit) ?
|
438 | init = val :
|
439 | init = f(init,val,i,list));
|
440 | });
|
441 | return init;
|
442 | })((function(___monad) {
|
443 | var mBind = ___monad.mBind;
|
444 | var mResult = ___monad.mResult;
|
445 | var mZero = ___monad.mZero;
|
446 | var mPlus = ___monad.mPlus;
|
447 | var ____mResult = function(___arg) {
|
448 | return (((typeof(___arg) === "undefined") && (!(typeof(mZero) === "undefined"))) ?
|
449 | mZero :
|
450 | mResult(___arg));
|
451 | };
|
452 | return mBind([1,2,3],function(a) {
|
453 | return mBind([3,4,5],function(b) {
|
454 | return (function() {
|
455 | return ____mResult((((a + b) <= 6) ?
|
456 | (function() {
|
457 | return (a + b);
|
458 | })() :
|
459 | undefined));
|
460 | })();
|
461 | });
|
462 | });
|
463 | })((function() {
|
464 | var _r = {};
|
465 | for(var i=0,l=arguments.length;i<l;i+=2){_r[arguments[i]]=arguments[i+1];}
|
466 | return _r;
|
467 | })("mBind",function(mv,mf) {
|
468 | return (function(arr,f,init) {
|
469 | var noInit = (arguments.length < 3);
|
470 | (function(o,f,s) {
|
471 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
472 | return undefined;
|
473 | })(arr,function(val,i,list) {
|
474 | return (((i === 0) && noInit) ?
|
475 | init = val :
|
476 | init = f(init,val,i,list));
|
477 | });
|
478 | return init;
|
479 | })((function(arr,f,scope) {
|
480 | var _r = [];
|
481 | (function(o,f,s) {
|
482 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
483 | return undefined;
|
484 | })(arr,function(val,i,list) {
|
485 | return _r.push(f.call(scope,val,i,list));
|
486 | });
|
487 | return _r;
|
488 | })(mv,mf),function(accum,val) {
|
489 | return accum.concat(val);
|
490 | },[]);
|
491 | },"mResult",function(v) {
|
492 | return [v];
|
493 | },"mZero",[],"mPlus",function() {
|
494 | return (function(arr,f,init) {
|
495 | var noInit = (arguments.length < 3);
|
496 | (function(o,f,s) {
|
497 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
498 | return undefined;
|
499 | })(arr,function(val,i,list) {
|
500 | return (((i === 0) && noInit) ?
|
501 | init = val :
|
502 | init = f(init,val,i,list));
|
503 | });
|
504 | return init;
|
505 | })(Array.prototype.slice.call(arguments),function(accum,val) {
|
506 | return accum.concat(val);
|
507 | },[]);
|
508 | })),function(accum,val) {
|
509 | return (accum + val);
|
510 | },0))) ?
|
511 | ("Passed - " + "arrayMonad when test") :
|
512 | ("Failed - " + "arrayMonad when test")),((true === (6 === (function(arr,f,init) {
|
513 | var noInit = (arguments.length < 3);
|
514 | (function(o,f,s) {
|
515 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
516 | return undefined;
|
517 | })(arr,function(val,i,list) {
|
518 | return (((i === 0) && noInit) ?
|
519 | init = val :
|
520 | init = f(init,val,i,list));
|
521 | });
|
522 | return init;
|
523 | })((function(___monad) {
|
524 | var mBind = ___monad.mBind;
|
525 | var mResult = ___monad.mResult;
|
526 | var mZero = ___monad.mZero;
|
527 | var mPlus = ___monad.mPlus;
|
528 | var ____mResult = function(___arg) {
|
529 | return (((typeof(___arg) === "undefined") && (!(typeof(mZero) === "undefined"))) ?
|
530 | mZero :
|
531 | mResult(___arg));
|
532 | };
|
533 | return mBind([1,2,0,null,3],function(a) {
|
534 | return (function() {
|
535 | return ____mResult((a ?
|
536 | (function() {
|
537 | return a;
|
538 | })() :
|
539 | undefined));
|
540 | })();
|
541 | });
|
542 | })((function() {
|
543 | var _r = {};
|
544 | for(var i=0,l=arguments.length;i<l;i+=2){_r[arguments[i]]=arguments[i+1];}
|
545 | return _r;
|
546 | })("mBind",function(mv,mf) {
|
547 | return (function(arr,f,init) {
|
548 | var noInit = (arguments.length < 3);
|
549 | (function(o,f,s) {
|
550 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
551 | return undefined;
|
552 | })(arr,function(val,i,list) {
|
553 | return (((i === 0) && noInit) ?
|
554 | init = val :
|
555 | init = f(init,val,i,list));
|
556 | });
|
557 | return init;
|
558 | })((function(arr,f,scope) {
|
559 | var _r = [];
|
560 | (function(o,f,s) {
|
561 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
562 | return undefined;
|
563 | })(arr,function(val,i,list) {
|
564 | return _r.push(f.call(scope,val,i,list));
|
565 | });
|
566 | return _r;
|
567 | })(mv,mf),function(accum,val) {
|
568 | return accum.concat(val);
|
569 | },[]);
|
570 | },"mResult",function(v) {
|
571 | return [v];
|
572 | },"mZero",[],"mPlus",function() {
|
573 | return (function(arr,f,init) {
|
574 | var noInit = (arguments.length < 3);
|
575 | (function(o,f,s) {
|
576 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
577 | return undefined;
|
578 | })(arr,function(val,i,list) {
|
579 | return (((i === 0) && noInit) ?
|
580 | init = val :
|
581 | init = f(init,val,i,list));
|
582 | });
|
583 | return init;
|
584 | })(Array.prototype.slice.call(arguments),function(accum,val) {
|
585 | return accum.concat(val);
|
586 | },[]);
|
587 | })),function(accum,val) {
|
588 | return (accum + val);
|
589 | },0))) ?
|
590 | ("Passed - " + "arrayMonad when null values test") :
|
591 | ("Failed - " + "arrayMonad when null values test")));
|
592 | };
|
593 | var browserTest = function() {
|
594 | var el = document.getElementById("testresult");
|
595 | return (el.outerHTML ?
|
596 | el.outerHTML = ["<pre>",(function(groupname,desc) {
|
597 | var start = new Date();
|
598 | var tests = groupname();
|
599 | var passed = 0;
|
600 | var failed = 0;
|
601 | (function(o,f,s) {
|
602 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
603 | return undefined;
|
604 | })(tests,function(elem) {
|
605 | return (elem.match(/^Passed/) ?
|
606 | ++passed :
|
607 | ++failed);
|
608 | });
|
609 | return [["\n",desc,"\n",start,"\n\n"].join(''),(function(arr,f,init) {
|
610 | var noInit = (arguments.length < 3);
|
611 | (function(o,f,s) {
|
612 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
613 | return undefined;
|
614 | })(arr,function(val,i,list) {
|
615 | return (((i === 0) && noInit) ?
|
616 | init = val :
|
617 | init = f(init,val,i,list));
|
618 | });
|
619 | return init;
|
620 | })(tests,function(___memo,elem,index) {
|
621 | return (___memo + [elem,"\n"].join(''));
|
622 | },""),"\nTotal tests ",tests.length,"\nPassed ",passed,"\nFailed ",failed,"\nDuration ",(new Date() - start),"ms\n"].join('');
|
623 | })(lispyscript,"LispyScript Testing"),"</pre>"].join('') :
|
624 | el.innerHTML = (function(groupname,desc) {
|
625 | var start = new Date();
|
626 | var tests = groupname();
|
627 | var passed = 0;
|
628 | var failed = 0;
|
629 | (function(o,f,s) {
|
630 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
631 | return undefined;
|
632 | })(tests,function(elem) {
|
633 | return (elem.match(/^Passed/) ?
|
634 | ++passed :
|
635 | ++failed);
|
636 | });
|
637 | return [["\n",desc,"\n",start,"\n\n"].join(''),(function(arr,f,init) {
|
638 | var noInit = (arguments.length < 3);
|
639 | (function(o,f,s) {
|
640 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
641 | return undefined;
|
642 | })(arr,function(val,i,list) {
|
643 | return (((i === 0) && noInit) ?
|
644 | init = val :
|
645 | init = f(init,val,i,list));
|
646 | });
|
647 | return init;
|
648 | })(tests,function(___memo,elem,index) {
|
649 | return (___memo + [elem,"\n"].join(''));
|
650 | },""),"\nTotal tests ",tests.length,"\nPassed ",passed,"\nFailed ",failed,"\nDuration ",(new Date() - start),"ms\n"].join('');
|
651 | })(lispyscript,"LispyScript Testing"));
|
652 | };
|
653 | ((typeof(window) === "undefined") ?
|
654 | console.log((function(groupname,desc) {
|
655 | var start = new Date();
|
656 | var tests = groupname();
|
657 | var passed = 0;
|
658 | var failed = 0;
|
659 | (function(o,f,s) {
|
660 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
661 | return undefined;
|
662 | })(tests,function(elem) {
|
663 | return (elem.match(/^Passed/) ?
|
664 | ++passed :
|
665 | ++failed);
|
666 | });
|
667 | return [["\n",desc,"\n",start,"\n\n"].join(''),(function(arr,f,init) {
|
668 | var noInit = (arguments.length < 3);
|
669 | (function(o,f,s) {
|
670 | if(o.forEach){o.forEach(f,s);}else{for(var i=0,l=o.length;i<l;++i)f.call(s||o,o[i],i,o);}
|
671 | return undefined;
|
672 | })(arr,function(val,i,list) {
|
673 | return (((i === 0) && noInit) ?
|
674 | init = val :
|
675 | init = f(init,val,i,list));
|
676 | });
|
677 | return init;
|
678 | })(tests,function(___memo,elem,index) {
|
679 | return (___memo + [elem,"\n"].join(''));
|
680 | },""),"\nTotal tests ",tests.length,"\nPassed ",passed,"\nFailed ",failed,"\nDuration ",(new Date() - start),"ms\n"].join('');
|
681 | })(lispyscript,"LispyScript Testing")) :
|
682 | window.onload = browserTest);
|