where $T$ is lookback; $\tau$ is horizon.
renders to
| local M = {} | |
| --- Find pattern in `s` and capture arguments into an array. | |
| --- @param s string | |
| --- @param pattern string | |
| --- @param arity integer | |
| --- @return integer|nil, integer|nil, string[] | |
| local function matchMacroHelper(s, pattern, arity) | |
| local i, j = s:find(pattern) | |
| local args = {} | 
| #lang s-exp framework/keybinding-lang | |
| (require drracket/tool-lib) | |
| (require racket/gui/base) | |
| (module test racket/base) | |
| (define (call-menu menu-item) | |
| (λ (ed evt) | |
| (define canvas (send ed get-canvas)) | |
| (when canvas | 
| # download git-prompt.sh from | |
| # https://github.com/git/git/raw/master/contrib/completion/git-prompt.sh | |
| # put it into ~/.git-prompt.sh | |
| source ~/.git-prompt.sh | |
| # Colors | |
| RESET_COLOR='\[\e[0m\]' | |
| BRIGHT_BLACK='\[\e[30;1m\]' | |
| RED='\[\e[31m\]' | 
| import Data.Char (isDigit) | |
| data Parser a = Parser (String -> [(a, String)]) | |
| instance Functor Parser where | |
| fmap f (Parser pa) = Parser $ \inp -> | |
| flip fmap (pa inp) $ \(a, out) -> (f a, out) | |
| instance Applicative Parser where | |
| pure a = Parser $ \inp -> [(a, inp)] | 
| prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b | |
| prism bt seta = dimap seta (either pure (fmap bt)) . right' | |
| type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t) | |
| prism :~: (b -> t) -> (s -> Either t a) -> p a (f b) -> p s (f t) | |
| class Profunctor p => Choice p where | |
| left' :: p a b -> p (Either a c) (Either b c) | |
| right' :: p a b -> p (Either c a) (Either c b) | 
| (defun scroll-up-half-screen () | |
| "<C-d> a la Vim" | |
| (interactive) | |
| (scroll-up-command) | |
| (recenter)) | |
| (global-set-key (kbd "C-;") 'scroll-up-half-screen) | |
| (defun scroll-down-half-screen () | |
| "<C-u> a la Vim" | |
| (interactive) | |
| (scroll-down-command) | 
| {-# LANGUAGE BinaryLiterals #-} | |
| import Data.Bits (Bits, xor, bit, testBit, complementBit, setBit, clearBit, (.&.), shiftR) | |
| import Data.Array (Array, listArray, (//), (!)) | |
| initialState = [0b0000, 0b0001, 0b0010, 0b0011] | |
| targetState = [0b0001, 0b0010, 0b0100, 0b1000] | |
| encodeState = sum . zipWith (*) [4096, 256, 16, 1] | 
| import Control.Monad | |
| import Data.List (transpose) | |
| import Text.Printf | |
| converge :: Eq a => (a -> a) -> a -> a | |
| converge f v = fst $ until theSame update (v, f v) | |
| where | |
| theSame (x, y) = x == y | |
| update (x, y) = (y, f y) | 
| import itertools | |
| def solve_memento(): | |
| rowNum = int(input('Row number: ')) | |
| colNum = int(input('Col number: ')) | |
| best = int(input('Best move: ')) | |
| print("Input table, 1 for solved, 0 for unsolved") | |
| table = [list(map(lambda x: True if int(x) == 1 else False, input().split())) for i in range(rowNum)] | |
| def check(): |