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 hexlife.core | |
(:use clojure.set)) | |
(defn nbrs [[x y]] | |
"Расчет координат соседей для данной клетки с координатами [x y]" | |
(let [++ (fn [x] (+ x 1)) -- (fn [x] (- x 1))] | |
#{[(-- x) (-- y)] [(-- (-- x)) y] [(-- x) (++ y)] | |
[(++ x) (-- y)] [(++ (++ x)) y] [(++ x) (++ y)]})) | |
; (= (nbrs [3 2]) #{[2 1] [4 3] [2 3] [1 2] [4 1] [5 2]}) |
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 logic-in-clojure.core | |
(:refer-clojure :exclude [==]) | |
(:use clojure.core.logic)) | |
;; prolog example: | |
;; | |
;; likes(wallace, cheese). | |
;; likes(grommit, cheese). | |
;; likes(wendolene, sheep). | |
;; friend(X, Y) :- \+(X = Y), likes(X, Z), likes(Y, Z). |
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
import static org.junit.Assume.assumeTrue; | |
import org.junit.experimental.theories.DataPoint; | |
import org.junit.experimental.theories.DataPoints; | |
import org.junit.experimental.theories.Theories; | |
import org.junit.experimental.theories.Theory; | |
import org.junit.runner.RunWith; | |
/** |
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
git checkout 4470c77223d48d8145fdd1be42743d88e341479f && git format-patch HEAD^ && | |
git checkout ef0924b4ae6a5d9775d478b1e98a8d26eef445bb && git format-patch HEAD^ --start-number 2 && | |
git checkout a870c8f9cd2b42b433ef6294a752475e0adba122 && git format-patch HEAD^ --start-number 3 && | |
git checkout 50deb9db151419882c1bdba10311024c05471875 && git format-patch HEAD^ --start-number 4 && | |
git checkout 3f46f94f94ac6fc676a2491848ec21f7e762cb50 && git format-patch HEAD^ --start-number 5 && | |
git checkout master |