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 sokoban.core | |
(:require [clojure.data.priority-map :refer [priority-map-keyfn-by]])) | |
(def test-plan "########\n#@ # a#\n# A # #\n# #\n# #\n########") | |
(def test-tricky "#######\n##bac #\n#@A #\n###BC #\n### #\n#######") | |
(def barrels (set "ABCDEFGHIJKLMNOPQRSTUVWXYZ")) | |
(def targets (set "abcdefghijklmnopqrstuvwxyz")) | |
(def player \@) | |
(def wall \#) |
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 non.core) | |
(def radioactivity 0.001) | |
(defn board | |
[cols rows] | |
(vec (repeat rows | |
(vec (repeat cols 0))))) | |
(defn random-board |
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 find-errors.core | |
(:require [clojurewerkz.elastisch.rest :as esr] | |
[clojurewerkz.elastisch.rest.document :as esd] | |
[clojurewerkz.elastisch.query :as q] | |
[clojurewerkz.elastisch.rest.response :as esrsp])) | |
(defn -main | |
[& args] | |
(esr/connect! "http://elasaticsearch:9200") | |
(let [res |
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 example.core | |
(:use [compojure.core] | |
[compojure.handler])) | |
(defroutes app | |
(GET "/" [] "Hello World!")) |
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 show-line [l] | |
(apply str (map #(if (= 1 %) \x \space) l))) | |
(defn show [w] | |
(str "\n----\n" | |
(apply str (interpose \newline (map show-line w))) | |
"\n----\n")) | |
(defn get-cell [w x y] | |
(if (and (< -1 x (count (first w))) |
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 sort) | |
(defn qsort [l] | |
(if (first l) | |
(concat | |
(qsort (filter #(< (first l) %) (rest l))) | |
[(first l)] | |
(qsort (filter #(>= (first l) %) (rest l)))) | |
())) |
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 logging.web-test | |
(:use midje.sweet | |
ring.mock.request | |
my-thing.web) | |
(:import [com.github.restdriver.clientdriver | |
ClientDriverFactory | |
ClientDriverRule | |
RestClientDriver])) | |
(def driver (.. (ClientDriverFactory.) (createClientDriver 8123))) |
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
module Parser where | |
data Token = Open_object | Close_object | Open_array | Close_array | List_delim | | |
Assign_delim | Quote | String_literal String deriving (Show, Eq, Read) | |
data JsonElement = FullJsonArray [JsonElement] | StringValue String deriving (Show, Eq, Read) | |
tokens :: [(Char, Token)] | |
tokens = [ | |
('{', Open_object), |
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 latin.core | |
(:use [clojure.contrib.seq-utils :only [positions]])) | |
(def sqrt (memoize (fn [x] (Math/sqrt x)))) | |
(def alphabet (memoize (fn [sq] (range 1 (sqrt (inc (count sq))))))) | |
(defn rows | |
"A sequence of the rows of the square" | |
[sq] |