Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Implement, as best as you can, the identity function in your favorite language
- (or the second favorite, if your favorite language happens to be Haskell).
- ```
- const identity = x => x;
- ```
- Implement the composition function in your favorite language.
- It takes two functions as arguments and returns a function that is their composition.
- ```
- const composition = (f, g) => (x => g(f(x)))
- ```
- Write a program that tries to test that your composition function respects identity.
- ```
- const f = x => `f(${x})`;
- composition(f, identity)('x'); //"f(x)"
- composition(identity, f)('x');
- ```
- Is the world-wide web a category in any sense? Are links morphisms?
- Yes.
- Is Facebook a category, with people as objects and friendships as morphisms?
- Yes, kind of.
- When is a directed graph a category?
Add Comment
Please, Sign In to add comment