Skip to content

Instantly share code, notes, and snippets.

@ngopal
Created December 5, 2014 20:25
Show Gist options
  • Save ngopal/d0ab43f71bdea81db402 to your computer and use it in GitHub Desktop.
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.
<!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>
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