I hereby claim:
- I am pjdelport on github.
- I am pjdelport (https://keybase.io/pjdelport) on keybase.
- I have a public key whose fingerprint is 5A44 5F43 932D FC9D 883B 84ED 1329 29ED A54F 5DCB
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
module Chain where | |
import Control.Applicative | |
import Data.List (tails, unfoldr) | |
import System.Random (RandomGen, newStdGen, randomR) | |
import qualified Data.Map.Strict as M | |
import Data.Sequence as S (Seq, (><), (|>)) | |
import qualified Data.Sequence as S |
# See http://tox.testrun.org/ | |
# | |
# Supported Python 2.* environments: py{26,27,py}-dj{13,14,dev} | |
# Supported Python 3.* environments: py{31,32}-djdev | |
[tox] | |
minversion = 1.4 | |
envlist = py27-dj14 | |
# envlist = | |
# py26-dj13, py26-dj14, py26-djdev, |
#!/bin/sh -e | |
dist="tinymce_${1:?}.zip" | |
wget -N "http://github.com/downloads/tinymce/tinymce/$dist" | |
unzip "$dist" | |
rm -r tinymce/examples | |
mv tinymce/changelog.txt tinymce_changelog.txt | |
cp -a tinymce/jscripts/tiny_mce/* js/tinymce/resources |
#!/usr/bin/env python | |
""" | |
Running:: | |
python pkg_tree.py | dot -Txlib | |
Requires `pydot`. | |
""" | |
import pkg_resources |
import inspect | |
def format_call(func, *positional, **named): | |
_locals = inspect.getcallargs(func, *positional, **named) | |
spec = inspect.getargspec(func) | |
argvalues = inspect.formatargvalues(spec.args, spec.varargs, spec.keywords, _locals) | |
return '{}{}'.format(func.__name__, argvalues) |
;;; Analogous to lambda, but curried. | |
(define-syntax curried | |
(syntax-rules () | |
((curried () body ...) (lambda () body ...)) | |
((curried (arg) body ...) (lambda (arg) body ...)) | |
((curried (arg args ...) body ...) | |
(lambda (arg . rest) | |
(let ((next (curried (args ...) body ...))) | |
(if (null? rest) | |
next |
-- Sequence a list of Either-yielding monadic actions. | |
-- Sequencing stops on the first Left value, or yields a list successful Right values. | |
sequenceRights :: Monad m => [m (Either e t)] -> m (Either e [t]) | |
sequenceRights [] = pure (pure []) | |
sequenceRights (x:xs) = handle =<< x | |
where | |
handle (Left e) = pure (Left e) | |
handle (Right t) = (t:) <<$>> sequenceRights xs | |
from collections import namedtuple | |
TOK_TEXT = 'TOK_TEXT' | |
TOK_LEFT_META = 'TOK_LEFT_META' | |
TOK_RIGHT_META = 'TOK_RIGHT_META' | |
TOK_DUMMY = 'TOK_DUMMY' | |
# A token has |