Skip to content

Commit

Permalink
Merge pull request #1 from bskyb-myersch/master
Browse files Browse the repository at this point in the history
Moved pimped list on Array into monet-pimp.js
  • Loading branch information
cwmyers committed Oct 22, 2013
2 parents c2505a2 + 7983a22 commit 43db892
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monet",
"version": "0.6.3",
"version": "0.6.4",
"main": ["src/main/javascript/monet.js","src/main/javascript/monet-pimp.js"],
"ignore": [
"**/.*",
Expand Down
6 changes: 5 additions & 1 deletion src/main/javascript/monet-pimp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// monet-pimp.js 0.6.3
// monet-pimp.js 0.6.4

// This file needs to be included after monet.js

Expand Down Expand Up @@ -26,6 +26,10 @@
return Validation.fail(this)
}

Array.prototype.list = function () {
return List.fromArray(this)
}

return this

})(window || this);
13 changes: 7 additions & 6 deletions src/main/javascript/monet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Monet.js 0.6.3
// Monet.js 0.6.4

// (c) 2012-2013 Chris Myers
// Monet.js may be freely distributed under the MIT license.
Expand All @@ -10,7 +10,7 @@

var curry = function (fn, args) {
return function () {
var args1 = args.append(Array.prototype.slice.call(arguments).list());
var args1 = args.append(List.fromArray(Array.prototype.slice.call(arguments)));
return args1.size() == fn.length ? fn.apply(this, args1.toArray()) : curry(fn, args1)
}
}
Expand Down Expand Up @@ -165,16 +165,17 @@

List.prototype.concat = List.prototype.append


Array.prototype.list = function () {
List.fromArray = function (array) {
var l = Nil
for (i = this.length; i--; i <= 0) {
l = l.cons(this[i])
for (i = array.length; i--; i <= 0) {
l = l.cons(array[i])
}
return l

}



/* Maybe Monad */

var Maybe = window.Maybe = {}
Expand Down

0 comments on commit 43db892

Please sign in to comment.