Created
December 5, 2014 20:25
-
-
Save ngopal/d0ab43f71bdea81db402 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/repehi // a weak attempt at implementing a barebones category theory library in javascript.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var obj = function (givenid) { | |
var id = givenid; | |
var name; | |
return {'id':id,'name':name}; | |
}; | |
var arrow = function (dom,codom) { | |
var id; | |
var domain = dom; | |
var codomain = codom; | |
var type; | |
return {'id':id, 'domain':domain, 'codomain':codomain, 'type':type}; | |
}; | |
var type = function () { | |
var id; | |
var name; | |
}; | |
var compose = function(one,two) { | |
var three; | |
if (one.codomain == two.domain) { | |
return three; | |
} | |
else { | |
return 'error'; | |
} | |
}; | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var obj = function (givenid) { | |
var id = givenid; | |
var name; | |
return {'id':id,'name':name}; | |
}; | |
var arrow = function (dom,codom) { | |
var id; | |
var domain = dom; | |
var codomain = codom; | |
var type; | |
return {'id':id, 'domain':domain, 'codomain':codomain, 'type':type}; | |
}; | |
var type = function () { | |
var id; | |
var name; | |
}; | |
var compose = function(one,two) { | |
var three; | |
if (one.codomain == two.domain) { | |
return three; | |
} | |
else { | |
return 'error'; | |
} | |
}; | |
</script></body> | |
</html> |
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 obj = function (givenid) { | |
var id = givenid; | |
var name; | |
return {'id':id,'name':name}; | |
}; | |
var arrow = function (dom,codom) { | |
var id; | |
var domain = dom; | |
var codomain = codom; | |
var type; | |
return {'id':id, 'domain':domain, 'codomain':codomain, 'type':type}; | |
}; | |
var type = function () { | |
var id; | |
var name; | |
}; | |
var compose = function(one,two) { | |
var three; | |
if (one.codomain == two.domain) { | |
return three; | |
} | |
else { | |
return 'error'; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment