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 'formula' | |
class Cmigemo < Formula | |
homepage 'http://www.kaoriya.net/software/cmigemo' | |
url 'http://cmigemo.googlecode.com/files/cmigemo-default-src-20110227.zip' | |
md5 '6e9b6f6ec96d4eb8bdd18e52b91e1b85' | |
depends_on 'nkf' | |
def patches |
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
user> (bench insert-vector [] 1000) | |
"Elapsed time: 117.616 msecs" | |
[835 483 229 138 454 643 450 636 792 357 35 455 986 249 181 25 966 519 590 71 ...] | |
user> (bench insert-vector' [] 1000) | |
"Elapsed time: 61.382 msecs" | |
[545 468 921 491 728 783 577 15 620 231 787 537 8 435 730 842 334 55 527 534 ...] |
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 tnoda.algorithm.topological-sort | |
(:import (java.util LinkedList BitSet Stack)) | |
(:use clojure.test)) | |
(defn- dfs-forest! | |
[g ^LinkedList order ^BitSet discovered ^Stack stack ^BitSet on-stack] | |
(letfn [(discover | |
[u] | |
(let [adjacencies (g u)] | |
(when (not-any? #(.get on-stack %) adjacencies) |
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 tnoda.bfs.eight-puzzle | |
(:import clojure.lang.PersistentQueue) | |
(:use clojure.test)) | |
(defn- board->state | |
[board] | |
{:board board | |
:zero (first (for [i (range 3) | |
j (range 3) | |
:when (= 0 (get-in board [i j]))] |
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
;;; http://melborne.github.com/2012/07/12/object-repeat-take-care-of-sequence/ | |
;;; を Clojure でやってみた。 | |
;;; 9.、10. は挫折www | |
;;; 1. 初項1、公差2の等差数列の最初の20項を求めなさい。 | |
(take 20 (iterate #(+ % 2) 1)) | |
;;; => (1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39) | |
;;; 2. 初項3、公比2の等比数列の最初の20項を求めなさい。 | |
(take 20 (iterate #(* % 2) 3)) |
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 'clojure.test) | |
(set! *unchecked-math* true) | |
(defprotocol Heap | |
"Protocol for heap." | |
(push! [this x]) | |
(pop! [this])) | |
(defrecord LongHeap [^longs heap, size] |
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 prime? [n] | |
(every? #(pos? (rem n %)) (range 2 (Math/sqrt (inc n))))) | |
(defn naive-primes [n] | |
(filter prime? (range 2 (inc n)))) |
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 learn-you-a-haskell.geometry.core | |
(:require (learn-you-a-haskell.geometry [sphere :as sphere] | |
[cuboid :as cuboid] | |
[cube :as cube]))) | |
(defn -main | |
"I don't do a whole lot." | |
[& args] | |
(print (sphere/volume 10))) |
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
;; Question: Inverse FizzBuzz (Clojure version) - Given a collection | |
;; whose elements are one of :fizz, :buzz, and :fizzbuzz, what's the | |
;; shortest contiguous sequence of numbers that produces that list when | |
;; you run fizzbuzz ? | |
;; | |
;; Originally introduced at: | |
;; http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html | |
(ns tnoda.inverse-fizzbuzz.core | |
(:use [clojure.test :only [deftest are]])) |
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
;;; cljdoc.el --- eldoc mode for clojure | |
;; Copyright (C) 2011 tomykaira | |
;; Version 0.1.0 | |
;; Keywords: eldoc clojure | |
;; Author: tomykaira <[email protected]> | |
;; URL: https://gist.github.com/1386472 | |
;; This file is not part of GNU Emacs. |