Skip to content

Instantly share code, notes, and snippets.

View chrisvest's full-sized avatar
🍉

Chris Vest chrisvest

🍉
View GitHub Profile
@chrisvest
chrisvest / .vimrc
Created February 22, 2009 00:32 — forked from bitprophet/.vimrc
.vimrc
syntax on
set background=dark
" Return cursor to the previous position when this file was open last
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
filetype plugin indent on
module Rpn
where
import qualified Data.Map as Map
data Operator a = Unary (a -> a)
| Binary (a -> a -> a)
| Ternary (a -> a -> a -> a)
| Quaternary (a -> a -> a -> a -> a)
| Reductive ([a] -> a)
#!/bin/bash
# Runs clojure.
# With no arguments, runs Clojure's REPL.
# Arguments starting with -J are unpack and passed to the JVM.
# Arguments -cp and -classpath are treated specially so we correctly
# build a classpath.
# If rlwrap is found, the java invocation is wrapped in it.
# For other arguments, the first is treated as a script name, the rest
# passed as command-line arguments.
#!/bin/bash
BREAK_CHARS="(){}[],^%$#@\"\";:''|\\"
CLOJURE_DIR=/home/cvh/workspace/clojure
CLOJURE_JAR=$CLOJURE_DIR/clojure.jar
CONTRIB_JAR=$CLOJURE_DIR-contrib/clojure-contrib.jar
if [ "-c" = "$1" ]; then
mkdir -p classes
java -cp .:classes:$CLOJURE_JAR -Dclojure.compile.path=classes clojure.lang.Compile "$2"
; Generate random output from input seed-text, using a Markov chain.
MAXGEN = 10000
NONWORD = "\n"
HEAD = NONWORD, NONWORD
prefix := HEAD
statetab = HashMap with-factory: (= Vector)
to start
Install Caliper http://code.google.com/p/caliper/
Clone https://github.com/chrisvest/stormpot
$ mvn package && ./benchmark stormpot.benchmark.PartitionSelect
Compare ModuloAtomicCount with ModuloIdentityHashNewObject
- you may subtract ModuloConst from both if you want, or
ModuloIdentityHashThread from ModuloIdentityHashNewObject,
to remove a bit of the overhead.
;; chrisvest's solution to http://4clojure.com/problem/28
(fn squash [xs]
(if (sequential? xs)
(mapcat squash xs)
(list xs)))
;; chrisvest's solution to http://4clojure.com/problem/29
(fn [s] (apply str (filter #(Character/isUpperCase %) s)))
;; chrisvest's solution to http://4clojure.com/problem/30
(fn [xs]
(reduce (fn [v x] (if (= x (last v)) v (conj v x))) [] xs))
;; chrisvest's solution to http://4clojure.com/problem/31
#(partition-by identity %)