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
(require 'package) | |
(add-to-list 'package-archives | |
'("marmalade" . | |
"http://marmalade-repo.org/packages/")) | |
(package-initialize) | |
(require 'undo-tree) | |
(require 'gist) |
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 foobar [] | |
(println "Foobar")) |
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 ieee2013.binpalindromes) | |
(defn log2up [x] | |
(int (Math/ceil (/ (Math/log x) | |
(Math/log 2) | |
2)))) | |
(defn problem [] | |
(let [[lower upper] | |
(mapv #(. Integer parseInt %) |
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 ieee2013.carpalind) | |
(require 'clojure.set) | |
(defn read-in [] | |
(let [n (- (read-string (read-line)) 1)] | |
(clojure.string/trim | |
(apply str (for [x (range n)] | |
(str (read-line) " ")))))) |
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 ieee2013.icecream) | |
(require 'clojure.set) | |
(defn- dfs | |
[graph goal] | |
(fn search | |
[path visited] | |
(let [current (peek path)] | |
(if (= goal current) |
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 ieee2013.subst) | |
(defn make-encoding [w c] | |
(if (= (count c) (count w)) | |
(map-indexed (fn [n x] {(nth w n) (nth c n)}) | |
w))) | |
(let [input | |
"2 | |
case |
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
#include <algorithm> | |
#include <functional> | |
#include <iostream> | |
#include <iomanip> | |
#include <sstream> | |
#include <map> | |
#include <stack> | |
#include <vector> | |
#include <stdlib.h> | |
#include <stdio.h> |
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
{ | |
"meta": { | |
"status": 200, | |
"msg": "OK" | |
}, | |
"response": { | |
"total_blogs": 15, | |
"blogs": [ | |
{ | |
"name": "twosillycorgis", |
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 largest-product-in-a-grid) | |
(def grid '[[8 2 22 97 38 15 0 40 0 75 4 5 7 78 52 12 50 77 91 8] | |
[49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 4 56 62 0] | |
[81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 3 49 13 36 65] | |
[52 70 95 23 4 60 11 42 69 24 68 56 1 32 56 71 37 2 36 91] | |
[22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80] | |
[24 47 32 60 99 3 45 2 44 75 33 53 78 36 84 20 35 17 12 50] | |
[32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70] | |
[67 26 20 68 2 62 12 20 95 63 94 39 63 8 40 91 66 49 94 21] |
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 highly-divisible-triangle-numbers | |
(:require [clojure.core.reducers :as r])) | |
(def triangles (reduce | |
(fn [x y] | |
(conj x (+ (peek x) y))) | |
[0] | |
(range 1 20000))) | |
(defn factors [n] |
OlderNewer