This file contains hidden or 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 parkour.examples.mmo | |
"Where `mmo` stands for Multiple Map Output." | |
(:require [clojure.string :as str] | |
[clojure.core.reducers :as r] | |
[parkour (conf :as conf) (fs :as fs) (wrapper :as w) | |
(mapreduce :as mr) (graph :as pg) (tool :as tool)] | |
[parkour.io (dseq :as dseq) (text :as text) (dux :as dux)] | |
[parkour.util :refer [returning]])) | |
(defn ->prefix |
This file contains hidden or 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 ... | |
(:import [clojure.lang IDeref] | |
...) | |
(definterface UUPrecalc) | |
(defprovider uu-precalc | |
^UUPrecalc [^UserDAO udao, ^UserEventDAO uedao] | |
(let [data ...] | |
(reify UUPrecalc IDeref (deref [_] data)))) |
This file contains hidden or 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 defmulti-group | |
"Define a group of related multimethods." | |
[& forms] `(do ~@(map #(cons 'defmulti %) forms))) | |
(defmacro defmethod-group | |
"Implement a group of related multimethods sharing common dispatch values." | |
[& specs] | |
(letfn [(parse-impls [specs] | |
(lazy-seq | |
(when (seq specs) |
This file contains hidden or 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 ropasc.core | |
(:refer-clojure :exclude [==]) | |
(:require [clara.rules :as cr :refer [defrule defquery ==]])) | |
(defrecord Action [player choice]) | |
(defrecord Victory [winner loser]) | |
(defrecord Tie [player1 player2]) |
This file contains hidden or 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 lenskit-hello.core | |
(:require [clojure.java.io :as io]) | |
(:import [org.grouplens.lenskit | |
ItemRecommender ItemScorer Recommender RecommenderBuildException] | |
[org.grouplens.lenskit.baseline | |
BaselineScorer ItemMeanRatingItemScorer UserMeanBaseline | |
UserMeanItemScorer] | |
[org.grouplens.lenskit.core | |
LenskitConfiguration LenskitRecommender] | |
[org.grouplens.lenskit.cursors Cursors] |
This file contains hidden or 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 -e | |
PACKAGE=leiningen | |
VERSION=2.1.2 | |
ITERATION=1 | |
DEBVERSION=${VERSION}+dbla.${ITERATION} | |
BINDIR=/opt/damballa/bin | |
LIBDIR=/opt/damballa/lib/leiningen |
This file contains hidden or 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 ^:private mean-sd-step | |
[[n m s] ^double x] | |
(let [n (long n), m (double m), s (double s) | |
n (inc n), d (- x m), m (+ m (/ d n)), s (+ s (* d (- x m)))] | |
[n m s])) | |
(defn mean-sd | |
"Calculate mean and (sample) standard-deviation of `vals`." | |
[vals] | |
(let [[n m s] (reduce mean-sd-step [0 0.0 0.0] vals)] |
This file contains hidden or 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 bench.core | |
(:require [criterium [core :as c]])) | |
(def | |
^{:arglists '([coll x] [coll x & xs]) | |
:doc "conj[oin]. Returns a new collection with the xs | |
'added'. (conj nil item) returns (item). The 'addition' may | |
happen at different 'places' depending on the concrete type." | |
:added "1.0" | |
:static true} |
This file contains hidden or 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
;; Extra xterm bindings | |
(require 'xterm) | |
(define-key xterm-function-map "\e[1;9A" [M-up]) | |
(define-key xterm-function-map "\e[1;9B" [M-down]) | |
(define-key xterm-function-map "\e[1;9C" [M-right]) | |
(define-key xterm-function-map "\e[1;9D" [M-left]) | |
(define-key xterm-function-map "\e[1;9F" [M-end]) | |
(define-key xterm-function-map "\e[1;9H" [M-home]) |
This file contains hidden or 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 p19-solution [] | |
(let [multiple? #(zero? (rem %1 %2)) | |
leap-year? #(or (and (multiple? % 4) | |
(not (multiple? % 100))) | |
(multiple? % 400)) | |
february #(if (leap-year? %) 29 28) | |
mdays [31 28 31 30 31 30 31 31 30 31 30 31] | |
mdays (map #(constantly %) mdays) | |
mdays (apply juxt (assoc (vec mdays) 1 february)) | |
months (mapcat mdays (range 1901 2001)) |