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
(defstruct board :size :values :value-index :all-transitions) | |
(defn create-board | |
"create a board of a given size" | |
[size] | |
(assert (> size 0)) | |
(let [values (vec (range 1 (inc size))) | |
value-index (reduce (fn [h i] (assoc h (values i) i)) {} (range 0 (count values))) | |
all-transitions (reduce (fn [t n] (assoc t n (set values))) {} values)] | |
(struct-map board |
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 puzzle) | |
(defstruct board :size :values :value-index :constraints) | |
(defn create-board | |
"create a board with given size and constraints" | |
[size constraints] | |
(assert (> size 0)) | |
(let [values (vec (range 1 (inc size))) | |
value-index (reduce (fn [h i] (assoc h (values i) i)) {} (range 0 (count values))) |
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 multi-split-with | |
"Returns a lazy collection of lists which elements ..." | |
[pred coll] | |
(let [[head tail] (split-with pred coll) | |
tail-without-seps (drop-while (complement pred) tail)] | |
(lazy-seq | |
(if (seq tail-without-seps) | |
(cons head (multi-split-with pred tail-without-seps)) | |
(list head))))) |
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
>> puts m.to_s | |
Date: Thu, 21 Oct 2010 16:28:20 +0100 | |
From: craig mcmillan <victorianexercises@gmail.com> | |
To: =?UTF-8?B?ImNyYWlnIOaXpeacrOWbvSI=?= <craig@trampolinesystems.com> | |
Message-ID: <4CC05C14.6030501@mccraig.net> | |
Subject: =?UTF-8?Q?big_in_=E6=97=A5=E6=9C=AC=E5=9B=BD?= | |
Mime-Version: 1.0 | |
Content-Type: text/plain; | |
charset=UTF-8; | |
format=flowed |
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
;; pin windows | |
(defun toggle-window-dedicated () | |
"Toggle whether the current active window is dedicated or not" | |
(interactive) | |
(message | |
(if (let (window (get-buffer-window (current-buffer))) | |
(set-window-dedicated-p window | |
(not (window-dedicated-p window)))) | |
"Window '%s' is dedicated" | |
"Window '%s' is normal") |
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
{"status":200, | |
"data": | |
{"longitude":0.1537217, | |
"name":"AUTONOMY SYSTEMS LIMITED", | |
"postcode":"CB4 0WZ", | |
"last_revenue_year":2010, | |
"last_tweet":null, | |
"colocated":["03857576","03879840","04255000","07117553","03266657","04031841","06063523","05212691","04217293","06917673","03008226","03781249","04858580","03891934","02926171"], | |
"directors":[ | |
{"name":"Mr Roberto Adriano Putland", |
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 'cascalog.api) | |
(use 'cascalog.playground) | |
(require '[clojure.tools.logging :as log]) | |
(require '[clojure.pprint :as pp]) | |
(bootstrap) | |
(defn vectorvector | |
[& vals] | |
[(apply vector vals)]) |
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
#!/usr/bin/env sh | |
if ! which md5sum > /dev/null; then | |
echo Install md5sum | |
exit 1 | |
fi | |
if ! which curl > /dev/null; then | |
echo Install curl | |
exit 1 |
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
;; ; specify S3 repositories with something like | |
;; | |
;; (set-env! | |
;; :wagons '[[s3-wagon-private "1.2.0"]] | |
;; :repositories #(concat % [["releases" {:url "s3p://your-s3-wagon-bucket/releases/" | |
;; :username [:env/aws_access_key :gpg] | |
;; :passphrase [:env/aws_secret_key :gpg]}] | |
;; ["snapshots" {:url "s3p://your-s3-wagon-bucket/snapshots/" | |
;; :username [:env/aws_access_key :gpg] |
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
;; ; specify S3 repositories with something like | |
;; | |
;; (set-env! | |
;; :wagons '[[s3-wagon-private "1.2.0"]] | |
;; :repositories #(concat % [["releases" {:url "s3p://your-s3-wagon-bucket/releases/" | |
;; :username [:env/aws_access_key :gpg] | |
;; :passphrase [:env/aws_secret_key :gpg]}] | |
;; ["snapshots" {:url "s3p://your-s3-wagon-bucket/snapshots/" | |
;; :username [:env/aws_access_key :gpg] |