This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bfs :: Tree a -> [a] | |
bfs t = | |
concatMap (map rootLabel) $ | |
takeWhile (not . null) $ | |
iterate (concatMap subForest) [t] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bunrui.Core | |
( Command | |
, Metadata(..) | |
, Opts(..) | |
, findSourceFiles | |
, missingDirectories | |
, readMetadata | |
) where | |
import Control.Applicative ((<$>), (<*), (<*>)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns com.caira.util.ringbuffer | |
(:import (clojure.lang Counted IPersistentCollection IPersistentVector | |
Indexed RT SeqIterator Seqable Util) | |
(java.util Collection List))) | |
(defn ^:private iterables-equiv? [^Iterable i1 ^Iterable i2] | |
(let [it1 (.iterator i1) | |
it2 (.iterator i2)] | |
(loop [] | |
(or (not (.hasNext it1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro defwith [name finalizer] | |
(let [bindings-sym (gensym "bindings") | |
body-sym (gensym "body")] | |
`(defmacro ~name [~bindings-sym & ~body-sym] | |
(cond | |
(empty? ~bindings-sym) `(do ~@~body-sym) | |
(symbol? (~bindings-sym 0)) | |
`(let ~(subvec ~bindings-sym 0 2) | |
(try | |
(~'~name ~(subvec ~bindings-sym 2) ~@~body-sym) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
"""Bootstrap distribute installation | |
If you want to use setuptools in your package's setup.py, just include this | |
file in the same directory with it, and add this to the top of your setup.py:: | |
from distribute_setup import use_setuptools | |
use_setuptools() | |
If you want to require a specific version of setuptools, set a download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
DISTRIBUTE_SETUP=https://raw.github.com/gist/2308340/d2c2899afa9894be579f48a7a6d4193e84a55b6b/distribute_setup.py | |
sudo -k | |
which easy_install &> /dev/null || wget -qO- $DISTRIBUTE_SETUP | sudo python | |
sudo easy_install django | |
sudo easy_install dotcloud |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
app=/Applications/Emacs.app/Contents/MacOS/Emacs | |
for arg; do | |
case $arg in | |
-version|--version|-f|-l|-eval|-batch|-nw) exec $app "$@" | |
esac | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set autowriteall | |
set backspace=indent,eol,start | |
set cinoptions=Ws,(0,t0 | |
set directory=~/.config/vim/swap,/tmp | |
set encoding=utf-8 | |
set expandtab | |
set formatoptions=q | |
set hidden | |
set hlsearch | |
set incsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;; | |
;; Initialization ;; | |
;;;;;;;;;;;;;;;;;;;; | |
(require 'cl) | |
(defmacro* dolist* ((iterator list &optional return-value) &rest body) | |
"Like `dolist' but `destructuring-bind's the elements of LIST. | |
If ITERATOR is a symbol then dolist* is just like `dolist' except |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TupleSections #-} | |
module RPN (main) where | |
import Control.Applicative ((<$>)) | |
import Control.Monad (forM_, unless) | |
import Control.Monad.Instances () | |
import Data.List (find, intercalate) | |
import Data.Maybe (listToMaybe) | |
import System.IO (stdout, hFlush) |