This is a SCRIPT-8 cassette.
I hereby claim:
- I am jjcomer on github.
- I am jjcomer (https://keybase.io/jjcomer) on keybase.
- I have a public key whose fingerprint is 8E60 EB2A 9A8F 5A4E 2146 3F4B 124D C290 7C94 9EF2
To claim this, I am signing this object:
I hereby claim:
- I am jjcomer on github.
- I am jjcomer (https://keybase.io/jjcomer) on keybase.
- I have a public key whose fingerprint is 951D BB52 4253 4B41 E48F 00BD 8FB0 6166 F8A9 582F
To claim this, I am signing this object:
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
;;; personal.el -- Josh's EMACS config | |
;; | |
;;; Commentary: | |
;; | |
;; My config for Emacs, using the prelude settings pack. | |
;; | |
;;; License: | |
;; | |
;;The MIT License (MIT) | |
;; |
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
(use '[clojure.set :only (difference union intersection)]) | |
(defn without | |
"Returns set s with x removed." | |
[s x] (disj s x)) | |
(defn take-1 | |
"Returns the pair [element, s'] where s' is set s with element removed." | |
[s] {:pre [(not (empty? s))]} | |
(let [item (first 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
(defn- json-request? | |
[req] | |
(if-let [#^String type (:content-type req)] | |
(not (empty? (re-find #"^application/(vnd.+)?json" type))))) | |
(defn wrap-json-params [handler] | |
(fn [req] | |
(if-let [body (and (json-request? req) (:body req))] | |
(let [bstr (slurp body) | |
json-params (parse-string bstr) |
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
(def c-order | |
(let [order [:id :title :author :date :price]] | |
(zipmap order (range (count order))))) | |
(defn column-sort | |
[k1 k2] | |
(compare (get c-order k1 -1) | |
(get c-order k2 -1))) | |
(def test-data |
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 median.analyze | |
(:use [median core] | |
[incanter core charts datasets stats])) | |
(defn test-lists | |
"Generate test lists applying f to p and n" | |
[n p f] | |
(map #(rand-list (f p %)) (range n))) | |
(defmacro time-it |
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 median.core | |
(:use [clojure.math.numeric-tower :only [floor ceil]])) | |
(defn rand-list | |
"Generates a random vector of length n with unique | |
values inclusive 1 to exclusive n" | |
[n] | |
(shuffle (map inc (range n)))) | |
(defn- median-skeleton |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Copyright (c) Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
; which can be found in the file CPL.TXT at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. | |
;As shown in the presentation: http://blip.tv/clojure/clojure-concurrency-819147 |
NewerOlder