View logic.py
# -*- coding: utf-8 -*-
from tabulate import tabulate
class Var(object):
def __init__(self, name):
self.name = name
self.value = None
def bind(self, value):
View async-timeline.clj
(defn fetch-user
[id]
(fetch-item id))
(defn fetch-post
[id]
(fetch-item id))
(defn timeline-ids
[username]
View concurrency-in-go.md
View css-parser.md
View kleene.clj
(ns kleene)
;;
;; Inspired by "Regexes, Kleene Algebras and Real Ultimate Power"
;; http://plastic-idolatry.com/erik/oslo2014.pdf
;;
;; What do we want to do?...
;;
;; (def p1 (times (Var. "w") (Var. "o") (Var. "w"))
;; (matches? p1 "wow") ;; true
View 001_monad_parser.py
## Alexey Kachayev, 2014
## Link to slides:
## http://goo.gl/n4ylC4
## Basic:
## type Parser = String -> Tree
## Composition
## type Parser = String -> (Tree, String)
View skew.py
def heap(el=None):
return (el, None, None)
def union((el1, left1, right1), (el2, left2, right2)):
if el1 is None: return (el2, left2, right2)
if el2 is None: return (el1, left1, right1)
if el1 < el2:
return (el1, union((el2, left2, right2), right1), left1)
else:
return (el2, union((el1, left1, right1), right2), left2)
View pairing1.hs
data Pairing a = Empty | Node a [Pairing a]
singleton x = Node x []
union Empty h2 = h2
union h1 Empty = h1
union t1@(Pairing h1 subs1) t2@(Pairing h2 subs)
| h1 < h2 = Pairing h1 t2:subs1
| otherwise = Pairing h2 t1:subs2
View skew1.hs
data Skew a = Empty | Node a (Skew a) (Skew a)
singleton x = Node x Empty Empty
union t1 Empty = t1
union Emtpy t2 = t2
union t1@(Node x1 l1 r1) t2@(Node x2 l2 r2)
| x1 <= x2 = Node x1 (union t2 r1) l1
| otherwise = Node x2 (union t1 r2) l2
View pairing.hs
data Pairing a = Empty | Node a [Pairing a]
singleton :: Ord a => a -> Pairing a
singleton x = Node x []
union :: Ord a => Pairing a -> Pairing a -> Pairing a
union Empty h2 = h2
union h1 Empty = h1
union t1@(Pairing h1 subs1) t2@(Pairing h2 subs)
| h1 < h2 = Pairing h1 t2:subs1