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
# on mac os X | |
# in case, your git is the "apple" version | |
sudo mv /usr/bin/git /usr/bin/git-apple | |
brew install git | |
brew update && brew upgrade git | |
sudo ln -s /usr/local/bin/git /usr/bin/git | |
# in case, it's already managed by brew | |
brew update && brew upgrade git |
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
; Original problem here : http://www.4clojure.com/problem/144 | |
; This first solution works but is incomplete as fs needs to be repeated. | |
(defn osci-incomplete [v & fs] | |
(reduce (fn [accu elt] (conj accu (elt (last accu)))) | |
[v] fs)) | |
; Problem is that cycling fs leads to timeout. | |
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
$ java -version | |
java version "1.6.0_31" | |
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635) | |
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode) | |
$ lein2 -v | |
Leiningen 2.0.0-preview4 on Java 1.6.0_31 Java HotSpot(TM) 64-Bit Server VM | |
$ lein2 new project | |
Generating a project called project based on the 'default' template. |
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
@wins_sticky = 0 | |
@wins_change = 0 | |
@nb_parties = 1000 | |
@possibles = [0, 1, 2] | |
def play | |
winner = rand(3) | |
first_choose = rand(3) | |
others = @possibles - [first_choose] | |
discarded = others.include?(winner) ? (others - [winner]).first : others[rand(2)] |
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
(def rules {7 "Qix" 5 "Bar" 3 "Foo"}) | |
(defn div [[n s]] | |
(fn [[x accu]] | |
[x (str accu (when (= 0 (rem x n)) s))])) | |
(defn to-ints [x] | |
(map #(- (int %) 48) (seq (str x)))) | |
(defn has [[x accu]] |
NewerOlder