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 large-sums) | |
(declare huge-vector) | |
(->> (apply + huge-vector) | |
(str) | |
(partition 10) | |
(first) | |
(apply str) | |
(println)) |
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 longest-collatz) | |
(def candidates (apply sorted-set (range 1 1000000))) | |
(defn collatz [current-trials n] | |
(loop [x n | |
c 0] | |
(if (= x 1) | |
(assoc current-trials n c) | |
(recur |
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 lattice-paths) | |
(defn factorial [n] | |
(reduce * (range 1N (inc n)))) | |
(defn binomial-coefficient [n k] | |
(/ (factorial n) | |
(* (factorial k) (factorial (- n k))))) | |
(binomial-coefficient 40 20) |
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 power-digit-sum | |
(:use [clojure.math.numeric-tower])) | |
(->> (expt 2N 1000) | |
(str) | |
(map str) | |
(map read-string) | |
(apply +)) |
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 factor.handler | |
(:use [compojure.core] | |
[hiccup core form page] | |
[me.raynes.conch :refer [programs with-programs let-programs]] | |
[clojure.core.async :as async :refer [<! >! chan go put!]] | |
[ring.middleware.params :only [wrap-params]] | |
[ring.util.response :as resp] | |
[incanter core stats charts datasets]) | |
(:require [compojure.handler :as handler] | |
[compojure.route :as route] |
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
-module(math1). | |
-export([area/1]). | |
area({square, Side}) -> | |
Side * Side; | |
area({rectangle, Side1, Side2}) -> | |
Side1 * Side2; | |
area({circle, Radius}) -> |
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 legendre-image | |
(:use quil.core)) | |
(declare compute-legendres) | |
(defn setup [] | |
(smooth) | |
(background 255 255 255) | |
(stroke 255 255 255) | |
(stroke-weight 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
(in-package #:decrypter) | |
(eval-when (:compile-toplevel) | |
(qtlc:utilize | |
:utilities '(:iota :riffle) | |
:categories '(:alexandria) | |
:symbols '(:split-sequence-if-not))) | |
(qtlc:utilize-symbols '(:split-sequence :split-sequence-if-not)) |
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 nethack.core | |
(:require | |
[cljs.core.async :as async | |
:refer [<! >! chan close! sliding-buffer put! alts! timeout]] | |
[goog.dom :as dom] | |
[goog.events :as events] | |
[crate.core :as crate] | |
[monet.canvas :as monet]) | |
(:require-macros [cljs.core.async.macros :as m :refer [go]])) |
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 levenshtein | |
(:require [clojure.string :as str])) | |
(defn slow-levenshtein | |
[a b] | |
(cond | |
(= 0 (count a)) (count b) | |
(= 0 (count b)) (count a) | |
:else (min (inc (slow-levenshtein (drop-last a) b)) | |
(inc (slow-levenshtein (drop-last b) a)) |