Last active
August 29, 2015 14:14
-
-
Save uriee/d6456f67086f7772a871 to your computer and use it in GitHub Desktop.
The Domain Object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var contain = function(arr,val); | |
var domain = function(arr,coTo,morphisem) { | |
return function(){ | |
var values = arr || []; | |
return { | |
morph : function(func){ | |
return domain(values.map(func)); | |
}, | |
morphTo : function(domain,morphisem){ | |
var codomain = values.map(morphisem); | |
var domval = domain.getValues() | |
var res = codomain.reduce(function(a,b){ | |
console.log(a,b,codomain,b in domval,domval); | |
if (b in domval) return a; | |
else return a.concat(b) | |
},[]) | |
console.log(res); | |
if(res) return false; else return true; | |
}, | |
getValues : function(){ | |
return values; | |
} | |
} | |
}() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment