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
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 |
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 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) |
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/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. |
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/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" |
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
; 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 |
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
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. |
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
;; chrisvest's solution to http://4clojure.com/problem/28 | |
(fn squash [xs] | |
(if (sequential? xs) | |
(mapcat squash xs) | |
(list xs))) |
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
;; chrisvest's solution to http://4clojure.com/problem/29 | |
(fn [s] (apply str (filter #(Character/isUpperCase %) s))) |
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
;; chrisvest's solution to http://4clojure.com/problem/30 | |
(fn [xs] | |
(reduce (fn [v x] (if (= x (last v)) v (conj v x))) [] xs)) |
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
;; chrisvest's solution to http://4clojure.com/problem/31 | |
#(partition-by identity %) |
OlderNewer