Skip to content

Instantly share code, notes, and snippets.

View DaQuirm's full-sized avatar

Alexander Gerasimov DaQuirm

View GitHub Profile
-- foldl using only foldr & lambdas
-- increase every number in a list by one except when it's not preceded by one
-- e.g. inc [1, 2, 1, 3, 4, 5] == [2, 2, 2, 3, 5, 6]
-- folding function
folder :: ([Int], Int) -> Int -> ([Int], Int)
folder (acc, u) item = (acc ++ [item + u], if item == 1 then 0 else 1)
-- initial acc value
{-# LANGUAGE NamedFieldPuns #-}
module Filter where
import Prelude hiding (floor)
import qualified Prelude
import Predicate
data Bezirk
@DaQuirm
DaQuirm / yoneda.md
Created February 12, 2017 11:23
Yoneda functor

Yi Ran (Adam) Yin @comraq Jan 16 00:13

from what little i have looked into category theory, the yoneda functor is the embedding of any category into the category of functors and natural transformations. The are 2 variants of the yoneda functor, covariant and contravariant which takes the category to a contravariant and covariant hom functor respectively. This is the yoneda embedding, which is a special case of the yoneda lemma. Basically its telling you that the objects and morphisms of any category is naturally isomorphic to the functor category where objects are set valued functors (functors taking C to the category of Sets where C is any category) and morphisms are natural transformations.

Yi Ran (Adam) Yin @comraq Jan 16 00:29

for example group/monoid actions, one can think of them as group/monoid homorphisms between the group/monoid and the symmetry group. The Yoneda functor is the generalized version this concept, taking the category (the category of the group/monoid) to the category of functor

@DaQuirm
DaQuirm / cssqd.json
Last active August 29, 2015 14:14
CSS Quickdraw sessions (RSConf 2015)
[{
"address": "192.168.1.61",
"name": "Nikita Khmourovitch",
"score": {
"0": {
"task_index": 0,
"time_ratio": 0.9653583333333333,
"selector": "div",
"elapsed": 4157,
"selector_length": 3