Skip to content

Commit 6e20cc6

Browse files
committed
Add underscore, partial and lambda.
1 parent b09a4a1 commit 6e20cc6

File tree

5 files changed

+1294
-12
lines changed

5 files changed

+1294
-12
lines changed

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@
432432
</div>
433433
<script src="lib/js/head.min.js"></script>
434434
<script src="js/reveal.min.js"></script>
435+
<script src="js/underscore.js"></script>
436+
<script src="js/partial.js"></script>
437+
<script src="js/lambda.js"></script>
435438
<script src="js/scratch-pad.js"></script>
436439
<script>
437440
// Full list of configuration options available here:

js/lambda.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(function (context) {
2+
var λ = {};
3+
4+
λ.map = function () {
5+
};
6+
7+
λ.reduce = function () {
8+
};
9+
})(this);

js/partial.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
(function (context) {
2+
// slice is shorter and I am a lazy.
3+
var slice = Array.prototype.slice;
4+
5+
Function.prototype.partial = function () {
6+
// TODO: Implement
7+
};
8+
9+
Function.prototype.partial = function () {
10+
var func = this;
11+
var args = slice.apply(arguments);
12+
13+
return function () {
14+
return func.apply(this, args.concat(slice.apply(arguments)));
15+
};
16+
};
17+
18+
Function.aprototype.partial = function () {
19+
// TODO: Implement
20+
};
21+
22+
Function.prototype.apartial = function (self) {
23+
var func = this;
24+
var args = slice.apply(arguments, 1);
25+
26+
return function () {
27+
return func.apply(self, args.concat(slice.apply(arguments)));
28+
};
29+
};
30+
31+
Function.object.partial = function (funcName) {
32+
// TODO: Implement
33+
};
34+
35+
Function.object.partial = function (funcName) {
36+
var func = this[funcName];
37+
var self = this;
38+
var args = slice.apply(arguments, 1);
39+
40+
return function () {
41+
return func.apply(self, args.concat(slice.apply(arguments)));
42+
};
43+
};
44+
})(this);

js/scratch-pad.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,3 @@
6666

6767
return context.Sample = Sample;
6868
})(this)
69-
70-
Function.prototype.partial = function () {
71-
// slice is shorter and I am a lazy.
72-
var slice = Array.prototype.slice;
73-
var func = this;
74-
var args = slice.apply(arguments);
75-
76-
return function () {
77-
debugger
78-
return func.apply(this, args.concat(slice.apply(arguments)));
79-
};
80-
};

0 commit comments

Comments
 (0)